Public Class Form1
Dim dl As Integer
Dim No As Integer
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
Button1.BackColor = Color.FromArgb(200, 200, 200)
Button2.BackColor = Color.FromArgb(200, 200, 200)
Button3.BackColor = Color.FromArgb(200, 200, 200)
Button4.BackColor = Color.FromArgb(200, 200, 200)
Button5.BackColor = Color.FromArgb(200, 200, 200)
Button6.BackColor = Color.FromArgb(200, 200, 200)
Button7.BackColor = Color.FromArgb(200, 200, 200)
Button8.BackColor = Color.FromArgb(200, 200, 200)
Button9.BackColor = Color.FromArgb(200, 200, 200)
Button1.Text = ""
Button2.Text = ""
Button3.Text = ""
Button4.Text = ""
Button5.Text = ""
Button6.Text = ""
Button7.Text = ""
Button8.Text = ""
Button9.Text = ""
No = 0
Randomize()
dl = Int(Rnd() * 9) + 1
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If dl = 1 Then
Button1.BackColor = Color.FromArgb(255, 0, 0)
End If
No = No + 1
Button1.Text = No
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If dl = 2 Then
Button2.BackColor = Color.FromArgb(255, 0, 0)
End If
No = No + 1
Button2.Text = No
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If dl = 3 Then
Button3.BackColor = Color.FromArgb(255, 0, 0)
End If
No = No + 1
Button3.Text = No
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If dl = 4 Then
Button4.BackColor = Color.FromArgb(255, 0, 0)
End If
No = No + 1
Button4.Text = No
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If dl = 5 Then
Button5.BackColor = Color.FromArgb(255, 0, 0)
End If
No = No + 1
Button5.Text = No
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If dl = 6 Then
Button6.BackColor = Color.FromArgb(255, 0, 0)
End If
No = No + 1
Button6.Text = No
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
If dl = 7 Then
Button7.BackColor = Color.FromArgb(255, 0, 0)
End If
No = No + 1
Button7.Text = No
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
If dl = 8 Then
Button8.BackColor = Color.FromArgb(255, 0, 0)
End If
No = No + 1
Button8.Text = No
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If dl = 9 Then
Button9.BackColor = Color.FromArgb(255, 0, 0)
End If
No = No + 1
Button9.Text = No
End Sub
End Class
沒有留言:
張貼留言