vb 编程 用三个滚动条控制红绿蓝色量,改变一个图片框的背景色 红绿蓝的色量值分别在上部的标签中显示
1个回答
展开全部
1个label1 1个picture1 3个 HScroll1 HScroll2 HScroll3
Private Sub Form_Load()
Picture1.BackColor = RGB(0, 0, 0)
HScroll1.Max = 255
HScroll2.Max = 255
HScroll3.Max = 255
Label1.AutoSize = True
Label1.Caption = ""
End Sub
Private Sub HScroll1_Change()
Picture1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
Label1.Caption = "红:" & HScroll1.Value & vbCrLf & "绿:" & HScroll2.Value & vbCrLf & "蓝:" & HScroll3.Value
End Sub
Private Sub HScroll2_Change()
Picture1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
Label1.Caption = "红:" & HScroll1.Value & vbCrLf & "绿:" & HScroll2.Value & vbCrLf & "蓝:" & HScroll3.Value
End Sub
Private Sub HScroll3_Change()
Picture1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
Label1.Caption = "红:" & HScroll1.Value & vbCrLf & "绿:" & HScroll2.Value & vbCrLf & "蓝:" & HScroll3.Value
End Sub
Private Sub Form_Load()
Picture1.BackColor = RGB(0, 0, 0)
HScroll1.Max = 255
HScroll2.Max = 255
HScroll3.Max = 255
Label1.AutoSize = True
Label1.Caption = ""
End Sub
Private Sub HScroll1_Change()
Picture1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
Label1.Caption = "红:" & HScroll1.Value & vbCrLf & "绿:" & HScroll2.Value & vbCrLf & "蓝:" & HScroll3.Value
End Sub
Private Sub HScroll2_Change()
Picture1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
Label1.Caption = "红:" & HScroll1.Value & vbCrLf & "绿:" & HScroll2.Value & vbCrLf & "蓝:" & HScroll3.Value
End Sub
Private Sub HScroll3_Change()
Picture1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
Label1.Caption = "红:" & HScroll1.Value & vbCrLf & "绿:" & HScroll2.Value & vbCrLf & "蓝:" & HScroll3.Value
End Sub
追问
红绿蓝的色量值分别在上部的标签中显示 这个怎么弄 就是滚动条在变的时候 标签中会显示那个颜色的值在变
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询