|
分類:[.NET 全般]
一応は遊ぶことは出来るのですが、表示される数字が今のままではランダムですので、スロットとしてはあまりにも使い勝手が悪く、どうすればいいのか判らず困っています。
数字の表示順を、LABELごとに固定するにはどう改良すればよろしいのでしょうか? どうか、どなたかアドバイスをお願いいたします。
ちなみに、以下が現在のプログラムのコードです。
Public Class Form1
Dim x, y, z, m As Integer
Sub aaaa()
If Timer1.Enabled = False And Timer2.Enabled = False And Timer3.Enabled = False Then
If x = y And y = z Then
Label4.Text = "Fever!"
m = m + 500
Label5.Text = m
Else
Label4.Text = "Boo!"
End If
End If
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
Select Case Val(Label1.Text)
Case 1
Label1.ForeColor = Color.BlueViolet
Case 2
Label1.ForeColor = Color.DarkOrange
Case 3
Label1.ForeColor = Color.DarkGreen
Case 4
Label1.ForeColor = Color.Crimson
Case 5
Label1.ForeColor = Color.Black
Case 6
Label1.ForeColor = Color.Beige
Case 7
Label1.ForeColor = Color.Blue
End Select
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
End
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
m = 1000
End Sub
Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click
Select Case Val(Label3.Text)
Case 1
Label3.ForeColor = Color.BlueViolet
Case 2
Label3.ForeColor = Color.DarkOrange
Case 3
Label3.ForeColor = Color.DarkGreen
Case 4
Label3.ForeColor = Color.Crimson
Case 5
Label3.ForeColor = Color.Black
Case 6
Label3.ForeColor = Color.Beige
Case 7
Label3.ForeColor = Color.Blue
End Select
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
m = m - 10
Label1.Text = ""
Timer1.Enabled = True
Timer2.Enabled = True
Timer3.Enabled = True
Label5.Text = m
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = False
aaaa()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer2.Enabled = False
aaaa()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Timer3.Enabled = False
aaaa()
End Sub
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click
Select Case Val(Label2.Text)
Case 1
Label2.ForeColor = Color.BlueViolet
Case 2
Label2.ForeColor = Color.DarkOrange
Case 3
Label2.ForeColor = Color.DarkGreen
Case 4
Label2.ForeColor = Color.Crimson
Case 5
Label2.ForeColor = Color.Black
Case 6
Label2.ForeColor = Color.Beige
Case 7
Label2.ForeColor = Color.Blue
End Select
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
x = Int(Rnd(1) * 7 + 1)
Label1.Text = x
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
y = Int(Rnd(1) * 7 + 1)
Label2.Text = y
End Sub
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
z = Int(Rnd(1) * 7 + 1)
Label3.Text = z
End Sub
End Class
|