猜笑脸.弄一个commandbutton控件数组,
Private Sub Command1_Click(Index As Integer) Randomize '随机变量初始化 a = Int(Rnd * 4) If a = Index Then
Command1(a).Enabled = False Label1.Caption = "你猜对了,真棒!" For i = 0 To 3 Command1(i).DisabledPicture = LoadPicture("C:\Documents and Settings\zhangnan\My Documents\My Pictures\校友会.gif") Next i '循环为四个按钮加图形 Else Command1(a).Enabled = False Label1.Caption = "你猜错了,我在这!" For i = 0 To 3 Command1(i).DisabledPicture = LoadPicture("C:\Documents and Settings\zhangnan\My Documents\My Pictures\校友会.gif") Next i End If
End Sub
Private Sub Command2_Click() For i = 0 To 3 Command1(i).Enabled = True Next i
End Sub
Private Sub Command3_Click() End End Sub
其中我觉得没有代码表明,所选的command1就是随机生成的command1(a),而且用for next增加按钮上的图形,我觉得每次四个按钮都会出现图形.可这个程序能用.我想不通.帮帮我.要按我的想法,就是
Command1(i).DisabledPicture = LoadPicture("C:\Documents and Settings\zhangnan\My )
if command1(a).click then'对了,这句应该怎么表示.我是这么梦想的.
label1.caption="你对了"
问的很笨,望见谅!![此贴子已经被作者于2004-05-10 17:32:03编辑过]