vb用三个滚动条控制label1的背景颜色

2025-03-08 10:50:04
推荐回答(1个)
回答1:

使用RGB 函数给label1控件BackColor属性赋值

RGB 函数,返回一个 Long整数,用来表示一个 RGB 颜色值。

Private Sub Form_Load()
    VScroll1.Max = 0
    VScroll2.Max = 0
    VScroll3.Max = 0
    VScroll1.Min = 255
    VScroll2.Min = 255
    VScroll3.Min = 255
    Label1.BackColor = RGB(VScroll1, VScroll2, VScroll3)
End Sub

Private Sub VScroll1_Change()
    Label1.BackColor = RGB(VScroll1, VScroll2, VScroll3)
    Debug.Print VScroll1; VScroll2; VScroll3
End Sub

Private Sub VScroll2_Change()
    Label1.BackColor = RGB(VScroll1, VScroll2, VScroll3)
    Debug.Print VScroll1; VScroll2; VScroll3
End Sub

Private Sub VScroll3_Change()
    Label1.BackColor = RGB(VScroll1, VScroll2, VScroll3)
    Debug.Print VScroll1; VScroll2; VScroll3
End Sub