VB滚动条RGB颜色的设置
OptionExplicitPrivateFunctionRevRGB(r,g,b) RevRGB=(r+g*256+b*65536)E...
Option ExplicitPrivate Function RevRGB(r, g, b) RevRGB = (r + g * 256 + b * 65536)End FunctionPrivate Function dtoh(x) Dim i, j As StringWhile x > 0 i = x Mod 16 x = Fix(x / 16) j = t(Trim(Str(i))) + jWendEnd FunctionPrivate Function t(x) Select Case x Case 10 x = "a" Case 11 x = "b" Case 12 x = "c" Case 13 x = "d" Case 14 x = "e" Case 15 x = "f" Case Else t = x End SelectEnd FunctionPrivate Sub HScroll1_scroll() Text1.BackColor = "&H" & dtoh(RevRGB(HScroll1.Value, HScroll2.Value, HScroll3.Value))End Sub这个程序为什么运行不了,请各位帮帮忙!
展开
1个回答
展开全部
你好象就是打算通过操纵滚动条来改变文本框的背景色,整这么复杂干什么?
Private Sub Form_Load()
For i = 0 To 2
HScroll1(i).Max = 255
HScroll1(i).Min = 0
HScroll1(i).Value = 0
Next
Text1.BackColor = RGB(0, 0, 0)
End Sub
Private Sub hScroll1_Change(Index As Integer)
Dim R_color As Long
Dim G_color As Long
Dim B_color As Long
R_color = HScroll1(0).Value
G_color = HScroll1(1).Value
B_color = HScroll1(2).Value
Text1.BackColor = RGB(R_color, G_color, B_color)
End Sub
Private Sub Form_Load()
For i = 0 To 2
HScroll1(i).Max = 255
HScroll1(i).Min = 0
HScroll1(i).Value = 0
Next
Text1.BackColor = RGB(0, 0, 0)
End Sub
Private Sub hScroll1_Change(Index As Integer)
Dim R_color As Long
Dim G_color As Long
Dim B_color As Long
R_color = HScroll1(0).Value
G_color = HScroll1(1).Value
B_color = HScroll1(2).Value
Text1.BackColor = RGB(R_color, G_color, B_color)
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询