Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Dim q As Integer
- Dim w As Integer
- Dim r As Integer
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- If w = 0 Then
- Button2.BackColor = Color.Green
- Button2.Text = "Стоп"
- Button1.Top = 12
- Button1.Left = 12
- Button1.Text = "0"
- Button1.BackColor = Color.White
- q = 0
- r = 0
- Timer1.Start()
- w = 1
- Else
- Button2.BackColor = Color.White
- Button2.Text = "Старт"
- Button1.Top = 69
- Button1.Left = 69
- Button1.BackColor = Color.White
- Button1.Text = ""
- q = 0
- r = 0
- Timer1.Stop()
- w = 0
- End If
- End Sub
- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
- If q = 0 Then
- If Button1.Top = 12 Then
- If Button1.Left < 127 Then
- Button1.Left = Button1.Left + 10
- End If
- End If
- If Button1.Left > 127 Then Button1.Left = 127
- Button1.BackColor = Color.White
- Button1.Text = "0"
- If Button1.Top = 12 And Button1.Left = 127 Then
- Button1.Text = "1"
- Button1.BackColor = Color.Red
- q = q + 1
- End If
- End If
- If q = 1 Then
- If Button1.BackColor = Color.Red Then
- If Button1.Top < 127 And Button1.Left > 12 Then
- Button1.Top = Button1.Top + 10
- Button1.Left = Button1.Left - 10
- End If
- If Button1.Top > 127 And Button1.Left < 12 Then
- Button1.Top = 127
- Button1.Left = 12
- End If
- End If
- If Button1.Top = 127 And Button1.Left = 12 Then
- Button1.Text = "2"
- Button1.BackColor = Color.Orange
- q = q + 1
- End If
- End If
- If q = 2 Then
- If Button1.BackColor = Color.Orange Then
- If Button1.Top > 12 And Button1.Left < 127 Then
- Button1.Top = Button1.Top - 10
- Button1.Left = Button1.Left + 10
- End If
- If Button1.Top < 12 And Button1.Left > 127 Then
- Button1.Top = 12
- Button1.Left = 127
- End If
- End If
- If Button1.Top = 12 And Button1.Left = 127 Then
- Button1.Text = "3"
- Button1.BackColor = Color.Yellow
- q = q + 1
- End If
- End If
- If q = 3 Then
- If Button1.Left = 127 Then
- If Button1.Top < 127 Then
- Button1.Top = Button1.Top + 10
- End If
- End If
- If Button1.Top > 127 Then Button1.Top = 127
- If Button1.Top = 127 And Button1.Left = 127 Then
- Button1.Text = "4"
- Button1.BackColor = Color.Green
- q = q + 1
- End If
- End If
- If q = 4 Then
- If Button1.BackColor = Color.Green Then
- If Button1.Top > 12 And Button1.Left > 12 Then
- Button1.Top = Button1.Top - 10
- Button1.Left = Button1.Left - 10
- End If
- If Button1.Top < 12 And Button1.Left < 12 Then
- Button1.Top = 12
- Button1.Left = 12
- End If
- End If
- If Button1.Top = 12 And Button1.Left = 12 Then
- Button1.Text = "5"
- Button1.BackColor = Color.Blue
- q = q + 1
- End If
- End If
- If q = 5 Then
- If Button1.BackColor = Color.Blue Then
- If Button1.Top < 127 And Button1.Left < 127 Then
- Button1.Top = Button1.Top + 10
- Button1.Left = Button1.Left + 10
- End If
- If Button1.Top > 127 And Button1.Left > 127 Then
- Button1.Top = 127
- Button1.Left = 127
- End If
- End If
- If Button1.Top = 127 And Button1.Left = 127 Then
- Button1.Text = "6"
- Button1.BackColor = Color.DarkBlue
- q = q + 1
- End If
- End If
- If q = 6 Then
- If Button1.Top = 127 Then
- If Button1.Left > 12 Then
- Button1.Left = Button1.Left - 10
- End If
- End If
- If Button1.Left < 12 Then Button1.Left = 12
- If Button1.Top = 127 And Button1.Left = 12 Then
- Button1.Text = "7"
- Button1.BackColor = Color.Purple
- q = q + 1
- End If
- End If
- If q = 7 Then
- If Button1.BackColor = Color.Purple Then
- If Button1.Top > 12 And Button1.Left < 127 Then
- Button1.Top = Button1.Top - 10
- Button1.Left = Button1.Left + 10
- End If
- If Button1.Top < 12 And Button1.Left > 127 Then
- Button1.Top = 12
- Button1.Left = 127
- End If
- End If
- If Button1.Top = 12 And Button1.Left = 127 Then
- Button1.Text = "8"
- Button1.BackColor = Color.DarkBlue
- q = q + 1
- End If
- End If
- If q = 8 Then
- If Button1.BackColor = Color.DarkBlue Then
- If Button1.Top < 127 And Button1.Left > 12 Then
- Button1.Top = Button1.Top + 10
- Button1.Left = Button1.Left - 10
- End If
- If Button1.Top > 127 And Button1.Left < 12 Then
- Button1.Top = 127
- Button1.Left = 12
- End If
- End If
- If Button1.Top = 127 And Button1.Left = 12 Then
- Button1.Text = "9"
- Button1.BackColor = Color.Green
- q = q + 1
- End If
- End If
- If q = 9 Then
- If Button1.Left = 12 Then
- If Button1.Top > 12 Then
- Button1.Top = Button1.Top - 10
- End If
- End If
- If Button1.Top < 12 Then Button1.Top = 12
- If Button1.Top = 12 And Button1.Left = 12 Then
- Button1.Text = "10"
- Button1.BackColor = Color.Yellow
- q = q + 1
- End If
- End If
- If q = 10 Then
- If Button1.BackColor = Color.Yellow Then
- If Button1.Top < 127 And Button1.Left < 127 Then
- Button1.Top = Button1.Top + 10
- Button1.Left = Button1.Left + 10
- End If
- If Button1.Top > 127 And Button1.Left > 127 Then
- Button1.Top = 127
- Button1.Left = 127
- End If
- End If
- If Button1.Top = 127 And Button1.Left = 127 Then
- Button1.Text = "11"
- Button1.BackColor = Color.Orange
- q = q + 1
- End If
- End If
- If q = 11 Then
- If Button1.BackColor = Color.Orange Then
- If Button1.Top > 12 And Button1.Left > 12 Then
- Button1.Top = Button1.Top - 10
- Button1.Left = Button1.Left - 10
- End If
- If Button1.Top < 12 And Button1.Left < 12 Then
- Button1.Top = 12
- Button1.Left = 12
- End If
- End If
- If Button1.Top = 12 And Button1.Left = 12 Then
- Button1.Text = "12"
- Button1.BackColor = Color.Red
- q = 0
- r = r + 1
- MsgBox(r)
- End If
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement