程式碼:
Dim x, y, z, p As Integer
Private Sub Command1_Click()
Randomize Timer
x = Int(Rnd * 3) + 1
Picture1.Visible = True
Picture2.Visible = False
Picture3.Visible = False
If (x = 1) Then
Text1.Text = "平手"
Picture4.Visible = True
Picture5.Visible = False
Picture6.Visible = False
p = p + 1
Text4.Text = p
ElseIf (x = 2) Then
Text1.Text = "你輸了"
Picture5.Visible = True
Picture4.Visible = False
Picture6.Visible = False
y = y + 1
Text3.Text = y
ElseIf (x = 3) Then
Text1.Text = "你贏了"
Picture6.Visible = True
Picture5.Visible = False
Picture4.Visible = False
z = z + 1
Text2.Text = z
End If
End Sub
Private Sub Command2_Click()
Randomize Timer
x = Int(Rnd * 3) + 1
Picture2.Visible = True
Picture1.Visible = False
Picture3.Visible = False
If (x = 1) Then
Text1.Text = "你贏了"
Picture4.Visible = True
Picture5.Visible = False
Picture6.Visible = False
z = z + 1
Text2.Text = z
ElseIf (x = 2) Then
Text1.Text = "平手"
Picture5.Visible = True
Picture4.Visible = False
Picture6.Visible = False
p = p + 1
Text4.Text = p
ElseIf (x = 3) Then
Text1.Text = "你輸了"
Picture6.Visible = True
Picture5.Visible = False
Picture4.Visible = False
y = y + 1
Text3.Text = y
End If
End Sub
Private Sub Command3_Click()
Randomize Timer
x = Int(Rnd * 3) + 1
Picture3.Visible = True
Picture2.Visible = False
Picture1.Visible = False
If (x = 1) Then
Text1.Text = "你輸了"
Picture4.Visible = True
Picture5.Visible = False
Picture6.Visible = False
y = y + 1
Text3.Text = y
ElseIf (x = 2) Then
Text1.Text = "你贏了"
Picture5.Visible = True
Picture4.Visible = False
Picture6.Visible = False
z = z + 1
Text2.Text = z
ElseIf (x = 3) Then
Text1.Text = "平手"
Picture6.Visible = True
Picture5.Visible = False
Picture4.Visible = False
p = p + 1
Text4.Text = p
End If
End Sub
Private Sub Form_Load()
Picture1.Visible = False
Picture2.Visible = False
Picture3.Visible = False
Picture4.Visible = False
Picture5.Visible = False
Picture6.Visible = False
Text1.Text = 0
Text2.Text = 0
Text3.Text = 0
Text4.Text = 0
End Sub
作者已經移除這則留言。
回覆刪除Private Sub Form_Load()
回覆刪除Picture1.Visible = False
Picture2.Visible = False
"Picture3.Visible = False"這一段我一直出問題,請問是為什麼
Picture4.Visible = False
Picture5.Visible = False
Picture6.Visible = False
Text1.Text = 0
Text2.Text = 0
Text3.Text = 0
Text4.Text = 0
End Sub