2个回答
2013-12-18
展开全部
创建5个数组控件(就是创建一个按钮,复制第一个按钮粘贴5个)写以下代码
dim ys&
private sub form_load()
ys=combo1(0).backcolor
end sub
private sub command1_click(index as integer)
static i%
if index=4 then
i=i+1
end if
if i mod 2=0 then
timer1.enabled=true
else
timer1.enabled=false
end if
end sub
private sub timer1.timer()
randomize
for i=0 to 3
command1(i).backcolor=rgb(int(rnd * 255),int(rnd * 255),int(rnd * 255))
next i
end sub
dim ys&
private sub form_load()
ys=combo1(0).backcolor
end sub
private sub command1_click(index as integer)
static i%
if index=4 then
i=i+1
end if
if i mod 2=0 then
timer1.enabled=true
else
timer1.enabled=false
end if
end sub
private sub timer1.timer()
randomize
for i=0 to 3
command1(i).backcolor=rgb(int(rnd * 255),int(rnd * 255),int(rnd * 255))
next i
end sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-12-18
展开全部
'将1-4的Style属性改为1,然后添加代码
Private Sub Command5_Click()
Randomize
Dim n As Integer
n = Int(Rnd * 4)
Select Case n
Case 0
Command1.BackColor = QBColor(Int(Rnd * 15))
Case 1
Command2.BackColor = QBColor(Int(Rnd * 15))
Case 2
Command3.BackColor = QBColor(Int(Rnd * 15))
Case 3
Command4.BackColor = QBColor(Int(Rnd * 15))
End Select
End Sub
Private Sub Command5_Click()
Randomize
Dim n As Integer
n = Int(Rnd * 4)
Select Case n
Case 0
Command1.BackColor = QBColor(Int(Rnd * 15))
Case 1
Command2.BackColor = QBColor(Int(Rnd * 15))
Case 2
Command3.BackColor = QBColor(Int(Rnd * 15))
Case 3
Command4.BackColor = QBColor(Int(Rnd * 15))
End Select
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询