本人菜鸟,求各位大侠给我几个代码
我想实现:窗口刷新(用Timer不卡)
几率(就是系统随机出数字或者随机选择)
本人新手,没有积分,抱歉啦~
Private Sub AAA() Dim i As Long, j As Long For i = 0 To 1000 For j = 0 To 1000 Text1.Text = i & " , " & j DoEvents '用Timer不卡 Next j Next i End Sub Private Sub Form_Load() Timer1.Enabled = True End Sub Private Sub Timer1_Timer() Call AAA Timer1.Enabled = False End Sub
Private Sub Command1_Click() Call Process(0) End Sub Private Sub Command2_Click() Call Process(1) End Sub Private Sub Command3_Click() Call Process(2) End Sub Private Sub Form_Load() Command1.Caption = "剪刀" Command2.Caption = "石頭" Command3.Caption = "布" End Sub Private Sub Process(ByVal UParam As Long) Randomize '系统随机出数字 Dim CParam As Long CParam = Int(Rnd * 3) '系统随机出数字 Select Case UParam Case 0 Select Case CParam Case 0 Call MsgBox("你出剪刀,電腦也出剪刀,所以是平手") Case 1 Call MsgBox("你出剪刀,電腦出石頭,所以是電腦贏") Case 2 Call MsgBox("你出剪刀,電腦出布,所以是你贏") End Select Case 1 Select Case CParam Case 0 Call MsgBox("你出石頭,電腦出剪刀,所以是你贏") Case 1 Call MsgBox("你出石頭,電腦也出石頭,所以是平手") Case 2 Call MsgBox("你出石頭,電腦出布,所以是電腦贏") End Select Case 2 Select Case CParam Case 0 Call MsgBox("你出布,電腦出剪刀,所以是電腦贏") Case 1 Call MsgBox("你出布,電腦出石頭,所以是你贏") Case 2 Call MsgBox("你出布,電腦也出布,所以是平手") End Select End Select End Sub