开发者

Setting background color of a form

开发者 https://www.devze.com 2023-01-07 12:26 出处:网络
Private Sub HScrollBar1_Scroll(ByVal sender As Object, _ 开发者_JS百科ByVal e As ScrollEventArgs) _
Private Sub HScrollBar1_Scroll(ByVal sender As Object, _
                    开发者_JS百科           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?


Me.BackColor = Color.FromArgb(255,255,255)

...replacing the 255 on each parameter with the value you need. e.g.

Me.BackColor = Color.FromArgb(HScrollBar1.Value,HScrollBar2.Value,HScrollBar3.Value)


Use Color.FromArgb()


As stated in the BackColor property documentation, use System.Drawing.Color


You can use formname.backcolor to set the background color of a form programatically. For example:

formname.backcolor = vbred

For a red form background color.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号