如何在VB.Net中设置标签背景色

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3305716/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 14:32:48  来源:igfitidea点击:

How to set label backcolor in VB.Net

.netvb.net

提问by cdxf

Here is the code :

这是代码:

Chess(z).BackColor = #FFFFFF

Chess(z).BackColor = #FFFFFF

It is not working, how to make it work :))

它不工作,如何使它工作:))

回答by Guffa

You can use color constants:

您可以使用颜色常量:

Chess(z).BackColor = Color.White

Or create a color value from color components

或从颜色分量创建颜色值

Chess(z).BackColor = Color.FromArgb(&HFF, &HFF, &HFF)

回答by dsolimano

If you are using Windows Forms, you probably want System.Drawing.Color. You can either use the static property Whiteor in the general case you can construct your own color using the FromArgbmethod.

如果您使用的是 Windows 窗体,您可能需要System.Drawing.Color。您可以使用静态属性,White或者在一般情况下,您可以使用该FromArgb方法构建自己的颜色。

If you are using WPF, you can achieve something similar by using System.Windows.Media.Colors.White, or constructing your own color using the FromRgb method on System.Windows.Media.Color.

如果您使用的是 WPF,您可以通过使用System.Windows.Media.Colors.White或使用System.Windows.Media.Color上的 FromRgb 方法构建您自己的颜色来实现类似的效果。