设计一个VB程序 5
设计一个VB程序,如下图所示。使用三个滚动条作为三种基本颜色的输入工具,合成的颜色显示在右边的颜色区中,颜色区实际上是一个标签(Label1),用合成的颜色设置其Back...
设计一个VB程序,如下图所示。使用三个滚动条作为三种基本颜色的输入工具,合成的颜色显示在右边的颜色区中,颜色区实际上是一个标签(Label1),用合成的颜色设置其BackColor属性。当完成调色以后,单击“应用”按钮设置文字的颜色
展开
3个回答
展开全部
'设置三个滚动条为控件数组HScroll1(),其中max为255,min为0,largechange为10,smallchange为1
Private Sub Command1_Click()
Label3.ForeColor = Label1.BackColor '文字颜色
End Sub
Private Sub Form_Load()
Dim hr As Integer, hg As Integer, hb As Integer
hr = HScroll1(0).Value '红
hg = HScroll1(1).Value '绿
hb = HScroll1(2).Value '蓝
Label1.BackColor = RGB(hr, hg, hb)
End Sub
Private Sub HScroll1_Change(Index As Integer)
Dim hr As Integer, hg As Integer, hb As Integer
hr = HScroll1(0).Value
hg = HScroll1(1).Value
hb = HScroll1(2).Value
Label1.BackColor = RGB(hr, hg, hb)
End Sub
Private Sub Command1_Click()
Label3.ForeColor = Label1.BackColor '文字颜色
End Sub
Private Sub Form_Load()
Dim hr As Integer, hg As Integer, hb As Integer
hr = HScroll1(0).Value '红
hg = HScroll1(1).Value '绿
hb = HScroll1(2).Value '蓝
Label1.BackColor = RGB(hr, hg, hb)
End Sub
Private Sub HScroll1_Change(Index As Integer)
Dim hr As Integer, hg As Integer, hb As Integer
hr = HScroll1(0).Value
hg = HScroll1(1).Value
hb = HScroll1(2).Value
Label1.BackColor = RGB(hr, hg, hb)
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
滚动条做控件数组:
Private Sub Form_Load()
For i = 0 To 2
HScroll1(i).Min = 0
HScroll1(i).Max = 255
HScroll1(i).LargeChange = 1
Next
HScroll1(0).Value = 0
HScroll1(1).Value = 0
HScroll1(2).Value = 255
End Sub
Private Sub HScroll1_Change(Index As Integer)
Label1.BackColor = RGB(HScroll1(0).Value, HScroll1(1).Value, HScroll1(2).Value)
End Sub
Private Sub Command1_Click()
Label2.ForeColor = Label1.BackColor
End Sub
Private Sub Form_Load()
For i = 0 To 2
HScroll1(i).Min = 0
HScroll1(i).Max = 255
HScroll1(i).LargeChange = 1
Next
HScroll1(0).Value = 0
HScroll1(1).Value = 0
HScroll1(2).Value = 255
End Sub
Private Sub HScroll1_Change(Index As Integer)
Label1.BackColor = RGB(HScroll1(0).Value, HScroll1(1).Value, HScroll1(2).Value)
End Sub
Private Sub Command1_Click()
Label2.ForeColor = Label1.BackColor
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
vb.net ?
还用VB?
vb 好象是 :rgb(红色, 绿色, 兰色)
红色, 绿色, 兰色 as integer
VB。NET是: Label1= Color.FromArgb(红色, 绿色, 兰色)
红色, 绿色, 兰色 as integer
还用VB?
vb 好象是 :rgb(红色, 绿色, 兰色)
红色, 绿色, 兰色 as integer
VB。NET是: Label1= Color.FromArgb(红色, 绿色, 兰色)
红色, 绿色, 兰色 as integer
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询