Public Class Form1    
    Dim acc As Integer     
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load     
        acc = 1000     
        Randomize()     
        Label1.Text = Int(Rnd() * 10)     
        Label2.Text = Int(Rnd() * 10)     
        Label3.Text = Int(Rnd() * 10)     
        Label4.Text = "$" & acc     
        With Label4     
            .Font = New Font("arial", 26, FontStyle.Bold)     
            .ForeColor = Color.Blue     
        End With 
        With Label1    
            .ForeColor = Color.Yellow     
            .BackColor = Color.Blue     
            .Font = New Font("arial", 66, FontStyle.Bold)     
        End With     
        With Label2     
            .ForeColor = Color.Yellow     
            .BackColor = Color.Blue     
            .Font = New Font("arial", 66, FontStyle.Bold)     
        End With     
        With Label3     
            .ForeColor = Color.Yellow     
            .BackColor = Color.Blue     
            .Font = New Font("arial", 66, FontStyle.Bold)     
        End With 
End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click    
        acc = acc - 50 
        Label1.Text = Int(Rnd() * 10)    
        Label2.Text = Int(Rnd() * 10)     
        Label3.Text = Int(Rnd() * 10) 
        Dim n7 = 0    
        If Label1.Text = 7 Then n7 = n7 + 1     
        If Label2.Text = 7 Then n7 = n7 + 1     
        If Label3.Text = 7 Then n7 = n7 + 1 
        If n7 = 1 Then acc = acc + 60    
        If n7 = 2 Then acc = acc + 600     
        If n7 = 3 Then acc = acc + 6000     
        Label4.Text = "$" & acc 
        If acc < 1000 Then Label4.ForeColor = Color.Red    
        If acc < 0 Then Label4.ForeColor = Color.Yellow 
    End Sub    
End Class

 
 
 發表文章
發表文章
 
 
沒有留言:
張貼留言