vb.net 设置表单的背景颜色
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3248612/
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
Setting background color of a form
提问by Pavalesh
Private Sub HScrollBar1_Scroll(ByVal sender As Object, _
ByVal e As ScrollEventArgs) _
Handles HScrollBar1.Scroll
Me.BackColor = HScrollBar1.Value
End Sub
How can I set the BackColor
of the form? How can I use an RGB value?
我怎样才能设置BackColor
表格的?如何使用 RGB 值?
回答by George Johnston
Me.BackColor = Color.FromArgb(255,255,255)
...replacing the 255 on each parameter with the value you need. e.g.
...用您需要的值替换每个参数上的 255。例如
Me.BackColor = Color.FromArgb(HScrollBar1.Value,HScrollBar2.Value,HScrollBar3.Value)
回答by BlueRaja - Danny Pflughoeft
回答by Anero
As stated in the BackColor property documentation, use System.Drawing.Color
回答by hanyainginmenolong
You can use formname.backcolor
to set the background color of a form programatically. For example:
您可以使用formname.backcolor
以编程方式设置表单的背景颜色。例如:
formname.backcolor = vbred
For a red form background color.
对于红色表单背景颜色。