Ecco i codici del programma:
Public Class Form1
Dim spost As Integer
Dim pi As Integer
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
If spost = 3 Then
Panel1.Location = New Point(Panel1.Location.X + 5, Panel1.Location.Y)
Panel6.Location = New Point(Panel6.Location.X - 5, Panel6.Location.Y)
If Panel1.Location.X = pi + 50 Then
Timer1.Stop()
End If
ElseIf spost = 4 Then
Panel1.Location = New Point(Panel1.Location.X, Panel1.Location.Y + 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y - 5)
If Panel1.Location.Y = pi + 50 Then
Timer1.Stop()
End If
ElseIf spost = 1 Then
Panel1.Location = New Point(Panel1.Location.X - 5, Panel1.Location.Y)
Panel6.Location = New Point(Panel6.Location.X + 5, Panel6.Location.Y)
If Panel1.Location.X = pi - 50 Then
Timer1.Stop()
End If
ElseIf spost = 2 Then
Panel1.Location = New Point(Panel1.Location.X, Panel1.Location.Y - 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y + 5)
If Panel1.Location.Y = pi - 50 Then
Timer1.Stop()
End If
End If
End Sub
Private Sub Label1_Click(sender As System.Object, e As System.EventArgs) Handles Label1.Click
If Panel6.Location.X = Panel1.Location.X - 50 And Panel6.Location.Y = Panel1.Location.Y Then
spost = 1
pi = Panel1.Location.X
Timer1.Start()
ElseIf Panel6.Location.X = Panel1.Location.X And Panel6.Location.Y = Panel1.Location.Y - 50 Then
spost = 2
pi = Panel1.Location.Y
Timer1.Start()
ElseIf Panel6.Location.X = Panel1.Location.X + 50 And Panel6.Location.Y = Panel1.Location.Y Then
spost = 3
pi = Panel1.Location.X
Timer1.Start()
ElseIf Panel6.Location.X = Panel1.Location.X And Panel6.Location.Y = Panel1.Location.Y + 50 Then
spost = 4
pi = Panel1.Location.Y
Timer1.Start()
End If
End Sub
Private Sub Label4_Click(sender As System.Object, e As System.EventArgs) Handles Label4.Click
If Panel6.Location.X = Panel4.Location.X - 50 And Panel6.Location.Y = Panel4.Location.Y Then
spost = 1
pi = Panel4.Location.X
Timer4.Start()
ElseIf Panel6.Location.X = Panel4.Location.X And Panel6.Location.Y = Panel4.Location.Y - 50 Then
spost = 2
pi = Panel4.Location.Y
Timer4.Start()
ElseIf Panel6.Location.X = Panel4.Location.X + 50 And Panel6.Location.Y = Panel4.Location.Y Then
spost = 3
pi = Panel4.Location.X
Timer4.Start()
ElseIf Panel6.Location.X = Panel4.Location.X And Panel6.Location.Y = Panel4.Location.Y + 50 Then
spost = 4
pi = Panel4.Location.Y
Timer4.Start()
End If
End Sub
Private Sub Timer2_Tick(sender As System.Object, e As System.EventArgs) Handles Timer2.Tick
If spost = 3 Then
Panel2.Location = New Point(Panel2.Location.X + 5, Panel2.Location.Y)
Panel6.Location = New Point(Panel6.Location.X - 5, Panel6.Location.Y)
If Panel2.Location.X = pi + 50 Then
Timer2.Stop()
End If
ElseIf spost = 4 Then
Panel2.Location = New Point(Panel2.Location.X, Panel2.Location.Y + 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y - 5)
If Panel2.Location.Y = pi + 50 Then
Timer2.Stop()
End If
ElseIf spost = 1 Then
Panel2.Location = New Point(Panel2.Location.X - 5, Panel2.Location.Y)
Panel6.Location = New Point(Panel6.Location.X + 5, Panel6.Location.Y)
If Panel2.Location.X = pi - 50 Then
Timer2.Stop()
End If
ElseIf spost = 2 Then
Panel2.Location = New Point(Panel2.Location.X, Panel2.Location.Y - 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y + 5)
If Panel2.Location.Y = pi - 50 Then
Timer2.Stop()
End If
End If
End Sub
Private Sub Timer4_Tick(sender As System.Object, e As System.EventArgs) Handles Timer4.Tick
If spost = 3 Then
Panel4.Location = New Point(Panel4.Location.X + 5, Panel4.Location.Y)
Panel6.Location = New Point(Panel6.Location.X - 5, Panel6.Location.Y)
If Panel4.Location.X = pi + 50 Then
Timer4.Stop()
End If
ElseIf spost = 4 Then
Panel4.Location = New Point(Panel4.Location.X, Panel4.Location.Y + 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y - 5)
If Panel4.Location.Y = pi + 50 Then
Timer4.Stop()
End If
ElseIf spost = 1 Then
Panel4.Location = New Point(Panel4.Location.X - 5, Panel4.Location.Y)
Panel6.Location = New Point(Panel6.Location.X + 5, Panel6.Location.Y)
If Panel4.Location.X = pi - 50 Then
Timer4.Stop()
End If
ElseIf spost = 2 Then
Panel4.Location = New Point(Panel4.Location.X, Panel4.Location.Y - 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y + 5)
If Panel4.Location.Y = pi - 50 Then
Timer4.Stop()
End If
End If
End Sub
Private Sub Label2_Click(sender As System.Object, e As System.EventArgs) Handles Label2.Click
If Panel6.Location.X = Panel2.Location.X - 50 And Panel6.Location.Y = Panel2.Location.Y Then
spost = 1
pi = Panel2.Location.X
Timer2.Start()
ElseIf Panel6.Location.X = Panel2.Location.X And Panel6.Location.Y = Panel2.Location.Y - 50 Then
spost = 2
pi = Panel2.Location.Y
Timer2.Start()
ElseIf Panel6.Location.X = Panel2.Location.X + 50 And Panel6.Location.Y = Panel2.Location.Y Then
spost = 3
pi = Panel2.Location.X
Timer2.Start()
ElseIf Panel6.Location.X = Panel2.Location.X And Panel6.Location.Y = Panel2.Location.Y + 50 Then
spost = 4
pi = Panel2.Location.Y
Timer2.Start()
End If
End Sub
Private Sub Timer3_Tick(sender As System.Object, e As System.EventArgs) Handles Timer3.Tick
If spost = 3 Then
Panel3.Location = New Point(Panel3.Location.X + 5, Panel3.Location.Y)
Panel6.Location = New Point(Panel6.Location.X - 5, Panel6.Location.Y)
If Panel3.Location.X = pi + 50 Then
Timer3.Stop()
End If
ElseIf spost = 4 Then
Panel3.Location = New Point(Panel3.Location.X, Panel3.Location.Y + 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y - 5)
If Panel3.Location.Y = pi + 50 Then
Timer3.Stop()
End If
ElseIf spost = 1 Then
Panel3.Location = New Point(Panel3.Location.X - 5, Panel3.Location.Y)
Panel6.Location = New Point(Panel6.Location.X + 5, Panel6.Location.Y)
If Panel3.Location.X = pi - 50 Then
Timer3.Stop()
End If
ElseIf spost = 2 Then
Panel3.Location = New Point(Panel3.Location.X, Panel3.Location.Y - 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y + 5)
If Panel3.Location.Y = pi - 50 Then
Timer3.Stop()
End If
End If
End Sub
Private Sub Timer5_Tick(sender As System.Object, e As System.EventArgs) Handles Timer5.Tick
If spost = 3 Then
Panel5.Location = New Point(Panel5.Location.X + 5, Panel5.Location.Y)
Panel6.Location = New Point(Panel6.Location.X - 5, Panel6.Location.Y)
If Panel5.Location.X = pi + 50 Then
Timer5.Stop()
End If
ElseIf spost = 4 Then
Panel5.Location = New Point(Panel5.Location.X, Panel5.Location.Y + 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y - 5)
If Panel5.Location.Y = pi + 50 Then
Timer5.Stop()
End If
ElseIf spost = 1 Then
Panel5.Location = New Point(Panel5.Location.X - 5, Panel5.Location.Y)
Panel6.Location = New Point(Panel6.Location.X + 5, Panel6.Location.Y)
If Panel5.Location.X = pi - 50 Then
Timer5.Stop()
End If
ElseIf spost = 2 Then
Panel5.Location = New Point(Panel5.Location.X, Panel5.Location.Y - 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y + 5)
If Panel5.Location.Y = pi - 50 Then
Timer5.Stop()
End If
End If
End Sub
Private Sub Label3_Click(sender As System.Object, e As System.EventArgs) Handles Label3.Click
If Panel6.Location.X = Panel3.Location.X - 50 And Panel6.Location.Y = Panel3.Location.Y Then
spost = 1
pi = Panel3.Location.X
Timer3.Start()
ElseIf Panel6.Location.X = Panel3.Location.X And Panel6.Location.Y = Panel3.Location.Y - 50 Then
spost = 2
pi = Panel3.Location.Y
Timer3.Start()
ElseIf Panel6.Location.X = Panel3.Location.X + 50 And Panel6.Location.Y = Panel3.Location.Y Then
spost = 3
pi = Panel3.Location.X
Timer3.Start()
ElseIf Panel6.Location.X = Panel3.Location.X And Panel6.Location.Y = Panel3.Location.Y + 50 Then
spost = 4
pi = Panel3.Location.Y
Timer3.Start()
End If
End Sub
Private Sub Label5_Click(sender As System.Object, e As System.EventArgs) Handles Label5.Click
If Panel6.Location.X = Panel5.Location.X - 50 And Panel6.Location.Y = Panel5.Location.Y Then
spost = 1
pi = Panel5.Location.X
Timer5.Start()
ElseIf Panel6.Location.X = Panel5.Location.X And Panel6.Location.Y = Panel5.Location.Y - 50 Then
spost = 2
pi = Panel5.Location.Y
Timer5.Start()
ElseIf Panel6.Location.X = Panel5.Location.X + 50 And Panel6.Location.Y = Panel5.Location.Y Then
spost = 3
pi = Panel5.Location.X
Timer5.Start()
ElseIf Panel6.Location.X = Panel5.Location.X And Panel6.Location.Y = Panel5.Location.Y + 50 Then
spost = 4
pi = Panel5.Location.Y
Timer5.Start()
End If
End Sub
Private Sub Label6_Click(sender As System.Object, e As System.EventArgs) Handles Label6.Click
If Panel6.Location.X = Panel7.Location.X - 50 And Panel6.Location.Y = Panel7.Location.Y Then
spost = 1
pi = Panel7.Location.X
Timer6.Start()
ElseIf Panel6.Location.X = Panel7.Location.X And Panel6.Location.Y = Panel7.Location.Y - 50 Then
spost = 2
pi = Panel7.Location.Y
Timer6.Start()
ElseIf Panel6.Location.X = Panel7.Location.X + 50 And Panel6.Location.Y = Panel7.Location.Y Then
spost = 3
pi = Panel7.Location.X
Timer6.Start()
ElseIf Panel6.Location.X = Panel7.Location.X And Panel6.Location.Y = Panel7.Location.Y + 50 Then
spost = 4
pi = Panel7.Location.Y
Timer6.Start()
End If
End Sub
Private Sub Label7_Click(sender As System.Object, e As System.EventArgs) Handles Label7.Click
If Panel6.Location.X = Panel8.Location.X - 50 And Panel6.Location.Y = Panel8.Location.Y Then
spost = 1
pi = Panel8.Location.X
Timer7.Start()
ElseIf Panel6.Location.X = Panel8.Location.X And Panel6.Location.Y = Panel8.Location.Y - 50 Then
spost = 2
pi = Panel8.Location.Y
Timer7.Start()
ElseIf Panel6.Location.X = Panel8.Location.X + 50 And Panel6.Location.Y = Panel8.Location.Y Then
spost = 3
pi = Panel8.Location.X
Timer7.Start()
ElseIf Panel6.Location.X = Panel8.Location.X And Panel6.Location.Y = Panel8.Location.Y + 50 Then
spost = 4
pi = Panel8.Location.Y
Timer7.Start()
End If
End Sub
Private Sub Label8_Click(sender As System.Object, e As System.EventArgs) Handles Label8.Click
If Panel6.Location.X = Panel9.Location.X - 50 And Panel6.Location.Y = Panel9.Location.Y Then
spost = 1
pi = Panel9.Location.X
Timer8.Start()
ElseIf Panel6.Location.X = Panel9.Location.X And Panel6.Location.Y = Panel9.Location.Y - 50 Then
spost = 2
pi = Panel9.Location.Y
Timer8.Start()
ElseIf Panel6.Location.X = Panel9.Location.X + 50 And Panel6.Location.Y = Panel9.Location.Y Then
spost = 3
pi = Panel9.Location.X
Timer8.Start()
ElseIf Panel6.Location.X = Panel9.Location.X And Panel6.Location.Y = Panel9.Location.Y + 50 Then
spost = 4
pi = Panel9.Location.Y
Timer8.Start()
End If
End Sub
Private Sub Timer6_Tick(sender As System.Object, e As System.EventArgs) Handles Timer6.Tick
If spost = 3 Then
Panel7.Location = New Point(Panel7.Location.X + 5, Panel7.Location.Y)
Panel6.Location = New Point(Panel6.Location.X - 5, Panel6.Location.Y)
If Panel7.Location.X = pi + 50 Then
Timer6.Stop()
End If
ElseIf spost = 4 Then
Panel7.Location = New Point(Panel7.Location.X, Panel7.Location.Y + 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y - 5)
If Panel7.Location.Y = pi + 50 Then
Timer6.Stop()
End If
ElseIf spost = 1 Then
Panel7.Location = New Point(Panel7.Location.X - 5, Panel7.Location.Y)
Panel6.Location = New Point(Panel6.Location.X + 5, Panel6.Location.Y)
If Panel7.Location.X = pi - 50 Then
Timer6.Stop()
End If
ElseIf spost = 2 Then
Panel7.Location = New Point(Panel7.Location.X, Panel7.Location.Y - 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y + 5)
If Panel7.Location.Y = pi - 50 Then
Timer6.Stop()
End If
End If
End Sub
Private Sub Timer7_Tick(sender As System.Object, e As System.EventArgs) Handles Timer7.Tick
If spost = 3 Then
Panel8.Location = New Point(Panel8.Location.X + 5, Panel8.Location.Y)
Panel6.Location = New Point(Panel6.Location.X - 5, Panel6.Location.Y)
If Panel8.Location.X = pi + 50 Then
Timer7.Stop()
End If
ElseIf spost = 4 Then
Panel8.Location = New Point(Panel8.Location.X, Panel8.Location.Y + 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y - 5)
If Panel8.Location.Y = pi + 50 Then
Timer7.Stop()
End If
ElseIf spost = 1 Then
Panel8.Location = New Point(Panel8.Location.X - 5, Panel8.Location.Y)
Panel6.Location = New Point(Panel6.Location.X + 5, Panel6.Location.Y)
If Panel8.Location.X = pi - 50 Then
Timer7.Stop()
End If
ElseIf spost = 2 Then
Panel8.Location = New Point(Panel8.Location.X, Panel8.Location.Y - 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y + 5)
If Panel8.Location.Y = pi - 50 Then
Timer7.Stop()
End If
End If
End Sub
Private Sub Timer8_Tick(sender As System.Object, e As System.EventArgs) Handles Timer8.Tick
If spost = 3 Then
Panel9.Location = New Point(Panel9.Location.X + 5, Panel9.Location.Y)
Panel6.Location = New Point(Panel6.Location.X - 5, Panel6.Location.Y)
If Panel9.Location.X = pi + 50 Then
Timer8.Stop()
End If
ElseIf spost = 4 Then
Panel9.Location = New Point(Panel9.Location.X, Panel9.Location.Y + 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y - 5)
If Panel9.Location.Y = pi + 50 Then
Timer8.Stop()
End If
ElseIf spost = 1 Then
Panel9.Location = New Point(Panel9.Location.X - 5, Panel9.Location.Y)
Panel6.Location = New Point(Panel6.Location.X + 5, Panel6.Location.Y)
If Panel9.Location.X = pi - 50 Then
Timer8.Stop()
End If
ElseIf spost = 2 Then
Panel9.Location = New Point(Panel9.Location.X, Panel9.Location.Y - 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y + 5)
If Panel9.Location.Y = pi - 50 Then
Timer8.Stop()
End If
End If
End Sub
Private Sub Timer9_Tick(sender As System.Object, e As System.EventArgs) Handles Timer9.Tick
If spost = 3 Then
Panel10.Location = New Point(Panel10.Location.X + 5, Panel10.Location.Y)
Panel6.Location = New Point(Panel6.Location.X - 5, Panel6.Location.Y)
If Panel10.Location.X = pi + 50 Then
Timer9.Stop()
End If
ElseIf spost = 4 Then
Panel10.Location = New Point(Panel10.Location.X, Panel10.Location.Y + 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y - 5)
If Panel10.Location.Y = pi + 50 Then
Timer9.Stop()
End If
elseIf spost = 1 Then
Panel10.Location = New Point(Panel10.Location.X - 5, Panel10.Location.Y)
Panel6.Location = New Point(Panel6.Location.X + 5, Panel6.Location.Y)
If Panel10.Location.X = pi - 50 Then
Timer9.Stop()
End If
ElseIf spost = 2 Then
Panel10.Location = New Point(Panel10.Location.X, Panel10.Location.Y - 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y + 5)
If Panel10.Location.Y = pi - 50 Then
Timer9.Stop()
End If
End If
End Sub
Private Sub Timer10_Tick(sender As System.Object, e As System.EventArgs) Handles Timer10.Tick
If spost = 3 Then
Panel11.Location = New Point(Panel11.Location.X + 5, Panel11.Location.Y)
Panel6.Location = New Point(Panel6.Location.X - 5, Panel6.Location.Y)
If Panel11.Location.X = pi + 50 Then
Timer10.Stop()
End If
ElseIf spost = 4 Then
Panel11.Location = New Point(Panel11.Location.X, Panel11.Location.Y + 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y - 5)
If Panel11.Location.Y = pi + 50 Then
Timer10.Stop()
End If
ElseIf spost = 1 Then
Panel11.Location = New Point(Panel11.Location.X - 5, Panel11.Location.Y)
Panel6.Location = New Point(Panel6.Location.X + 5, Panel6.Location.Y)
If Panel11.Location.X = pi - 50 Then
Timer10.Stop()
End If
ElseIf spost = 2 Then
Panel11.Location = New Point(Panel11.Location.X, Panel11.Location.Y - 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y + 5)
If Panel11.Location.Y = pi - 50 Then
Timer10.Stop()
End If
End If
End Sub
Private Sub Timer11_Tick(sender As System.Object, e As System.EventArgs) Handles Timer11.Tick
If spost = 3 Then
Panel12.Location = New Point(Panel12.Location.X + 5, Panel12.Location.Y)
Panel6.Location = New Point(Panel6.Location.X - 5, Panel6.Location.Y)
If Panel12.Location.X = pi + 50 Then
Timer11.Stop()
End If
ElseIf spost = 4 Then
Panel12.Location = New Point(Panel12.Location.X, Panel12.Location.Y + 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y - 5)
If Panel12.Location.Y = pi + 50 Then
Timer11.Stop()
End If
ElseIf spost = 1 Then
Panel12.Location = New Point(Panel12.Location.X - 5, Panel12.Location.Y)
Panel6.Location = New Point(Panel6.Location.X + 5, Panel6.Location.Y)
If Panel12.Location.X = pi - 50 Then
Timer11.Stop()
End If
ElseIf spost = 2 Then
Panel12.Location = New Point(Panel12.Location.X, Panel12.Location.Y - 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y + 5)
If Panel12.Location.Y = pi - 50 Then
Timer11.Stop()
End If
End If
End Sub
Private Sub Timer12_Tick(sender As System.Object, e As System.EventArgs) Handles Timer12.Tick
If spost = 3 Then
Panel13.Location = New Point(Panel13.Location.X + 5, Panel13.Location.Y)
Panel6.Location = New Point(Panel6.Location.X - 5, Panel6.Location.Y)
If Panel13.Location.X = pi + 50 Then
Timer12.Stop()
End If
ElseIf spost = 4 Then
Panel13.Location = New Point(Panel13.Location.X, Panel13.Location.Y + 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y - 5)
If Panel13.Location.Y = pi + 50 Then
Timer12.Stop()
End If
ElseIf spost = 1 Then
Panel13.Location = New Point(Panel13.Location.X - 5, Panel13.Location.Y)
Panel6.Location = New Point(Panel6.Location.X + 5, Panel6.Location.Y)
If Panel13.Location.X = pi - 50 Then
Timer12.Stop()
End If
ElseIf spost = 2 Then
Panel13.Location = New Point(Panel13.Location.X, Panel13.Location.Y - 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y + 5)
If Panel13.Location.Y = pi - 50 Then
Timer12.Stop()
End If
End If
End Sub
Private Sub Timer13_Tick(sender As System.Object, e As System.EventArgs) Handles Timer13.Tick
If spost = 3 Then
Panel14.Location = New Point(Panel14.Location.X + 5, Panel14.Location.Y)
Panel6.Location = New Point(Panel6.Location.X - 5, Panel6.Location.Y)
If Panel14.Location.X = pi + 50 Then
Timer13.Stop()
End If
ElseIf spost = 4 Then
Panel14.Location = New Point(Panel14.Location.X, Panel14.Location.Y + 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y - 5)
If Panel14.Location.Y = pi + 50 Then
Timer13.Stop()
End If
ElseIf spost = 1 Then
Panel14.Location = New Point(Panel14.Location.X - 5, Panel14.Location.Y)
Panel6.Location = New Point(Panel6.Location.X + 5, Panel6.Location.Y)
If Panel14.Location.X = pi - 50 Then
Timer13.Stop()
End If
ElseIf spost = 2 Then
Panel14.Location = New Point(Panel14.Location.X, Panel14.Location.Y - 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y + 5)
If Panel14.Location.Y = pi - 50 Then
Timer13.Stop()
End If
End If
End Sub
Private Sub Timer14_Tick(sender As System.Object, e As System.EventArgs) Handles Timer14.Tick
If spost = 3 Then
Panel15.Location = New Point(Panel15.Location.X + 5, Panel15.Location.Y)
Panel6.Location = New Point(Panel6.Location.X - 5, Panel6.Location.Y)
If Panel15.Location.X = pi + 50 Then
Timer14.Stop()
End If
ElseIf spost = 4 Then
Panel15.Location = New Point(Panel15.Location.X, Panel15.Location.Y + 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y - 5)
If Panel15.Location.Y = pi + 50 Then
Timer14.Stop()
End If
ElseIf spost = 1 Then
Panel15.Location = New Point(Panel15.Location.X - 5, Panel15.Location.Y)
Panel6.Location = New Point(Panel6.Location.X + 5, Panel6.Location.Y)
If Panel15.Location.X = pi - 50 Then
Timer14.Stop()
End If
ElseIf spost = 2 Then
Panel15.Location = New Point(Panel15.Location.X, Panel15.Location.Y - 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y + 5)
If Panel15.Location.Y = pi - 50 Then
Timer14.Stop()
End If
End If
End Sub
Private Sub Label9_Click(sender As System.Object, e As System.EventArgs) Handles Label9.Click
If Panel6.Location.X = Panel10.Location.X - 50 And Panel6.Location.Y = Panel10.Location.Y Then
spost = 1
pi = Panel10.Location.X
Timer9.Start()
ElseIf Panel6.Location.X = Panel10.Location.X And Panel6.Location.Y = Panel10.Location.Y - 50 Then
spost = 2
pi = Panel10.Location.Y
Timer9.Start()
ElseIf Panel6.Location.X = Panel10.Location.X + 50 And Panel6.Location.Y = Panel10.Location.Y Then
spost = 3
pi = Panel10.Location.X
Timer9.Start()
ElseIf Panel6.Location.X = Panel10.Location.X And Panel6.Location.Y = Panel10.Location.Y + 50 Then
spost = 4
pi = Panel10.Location.Y
Timer9.Start()
End If
End Sub
Private Sub Label10_Click(sender As System.Object, e As System.EventArgs) Handles Label10.Click
If Panel6.Location.X = Panel11.Location.X - 50 And Panel6.Location.Y = Panel11.Location.Y Then
spost = 1
pi = Panel11.Location.X
Timer10.Start()
ElseIf Panel6.Location.X = Panel11.Location.X And Panel6.Location.Y = Panel11.Location.Y - 50 Then
spost = 2
pi = Panel11.Location.Y
Timer10.Start()
ElseIf Panel6.Location.X = Panel11.Location.X + 50 And Panel6.Location.Y = Panel11.Location.Y Then
spost = 3
pi = Panel11.Location.X
Timer10.Start()
ElseIf Panel6.Location.X = Panel11.Location.X And Panel6.Location.Y = Panel11.Location.Y + 50 Then
spost = 4
pi = Panel11.Location.Y
Timer10.Start()
End If
End Sub
Private Sub Label11_Click(sender As System.Object, e As System.EventArgs) Handles Label11.Click
If Panel6.Location.X = Panel12.Location.X - 50 And Panel6.Location.Y = Panel12.Location.Y Then
spost = 1
pi = Panel12.Location.X
Timer11.Start()
ElseIf Panel6.Location.X = Panel12.Location.X And Panel6.Location.Y = Panel12.Location.Y - 50 Then
spost = 2
pi = Panel12.Location.Y
Timer11.Start()
ElseIf Panel6.Location.X = Panel12.Location.X + 50 And Panel6.Location.Y = Panel12.Location.Y Then
spost = 3
pi = Panel12.Location.X
Timer11.Start()
ElseIf Panel6.Location.X = Panel12.Location.X And Panel6.Location.Y = Panel12.Location.Y + 50 Then
spost = 4
pi = Panel12.Location.Y
Timer11.Start()
End If
End Sub
Private Sub Label12_Click(sender As System.Object, e As System.EventArgs) Handles Label12.Click
If Panel6.Location.X = Panel13.Location.X - 50 And Panel6.Location.Y = Panel13.Location.Y Then
spost = 1
pi = Panel13.Location.X
Timer12.Start()
ElseIf Panel6.Location.X = Panel13.Location.X And Panel6.Location.Y = Panel13.Location.Y - 50 Then
spost = 2
pi = Panel13.Location.Y
Timer12.Start()
ElseIf Panel6.Location.X = Panel13.Location.X + 50 And Panel6.Location.Y = Panel13.Location.Y Then
spost = 3
pi = Panel13.Location.X
Timer12.Start()
ElseIf Panel6.Location.X = Panel13.Location.X And Panel6.Location.Y = Panel13.Location.Y + 50 Then
spost = 4
pi = Panel13.Location.Y
Timer12.Start()
End If
End Sub
Private Sub Label13_Click(sender As System.Object, e As System.EventArgs) Handles Label13.Click
If Panel6.Location.X = Panel14.Location.X - 50 And Panel6.Location.Y = Panel14.Location.Y Then
spost = 1
pi = Panel14.Location.X
Timer13.Start()
ElseIf Panel6.Location.X = Panel14.Location.X And Panel6.Location.Y = Panel14.Location.Y - 50 Then
spost = 2
pi = Panel14.Location.Y
Timer13.Start()
ElseIf Panel6.Location.X = Panel14.Location.X + 50 And Panel6.Location.Y = Panel14.Location.Y Then
spost = 3
pi = Panel14.Location.X
Timer13.Start()
ElseIf Panel6.Location.X = Panel14.Location.X And Panel6.Location.Y = Panel14.Location.Y + 50 Then
spost = 4
pi = Panel14.Location.Y
Timer13.Start()
End If
End Sub
Private Sub Label14_Click(sender As System.Object, e As System.EventArgs) Handles Label14.Click
If Panel6.Location.X = Panel15.Location.X - 50 And Panel6.Location.Y = Panel15.Location.Y Then
spost = 1
pi = Panel15.Location.X
Timer14.Start()
ElseIf Panel6.Location.X = Panel15.Location.X And Panel6.Location.Y = Panel15.Location.Y - 50 Then
spost = 2
pi = Panel15.Location.Y
Timer14.Start()
ElseIf Panel6.Location.X = Panel15.Location.X + 50 And Panel6.Location.Y = Panel15.Location.Y Then
spost = 3
pi = Panel15.Location.X
Timer14.Start()
ElseIf Panel6.Location.X = Panel15.Location.X And Panel6.Location.Y = Panel15.Location.Y + 50 Then
spost = 4
pi = Panel15.Location.Y
Timer14.Start()
End If
End Sub
Private Sub Label15_Click(sender As System.Object, e As System.EventArgs) Handles Label15.Click
If Panel6.Location.X = Panel16.Location.X - 50 And Panel6.Location.Y = Panel16.Location.Y Then
spost = 1
pi = Panel16.Location.X
Timer15.Start()
ElseIf Panel6.Location.X = Panel16.Location.X And Panel6.Location.Y = Panel16.Location.Y - 50 Then
spost = 2
pi = Panel16.Location.Y
Timer15.Start()
ElseIf Panel6.Location.X = Panel16.Location.X + 50 And Panel6.Location.Y = Panel16.Location.Y Then
spost = 3
pi = Panel16.Location.X
Timer15.Start()
ElseIf Panel6.Location.X = Panel16.Location.X And Panel6.Location.Y = Panel16.Location.Y + 50 Then
spost = 4
pi = Panel16.Location.Y
Timer15.Start()
End If
End Sub
Private Sub Timer15_Tick(sender As System.Object, e As System.EventArgs) Handles Timer15.Tick
If spost = 3 Then
Panel16.Location = New Point(Panel16.Location.X + 5, Panel16.Location.Y)
Panel6.Location = New Point(Panel6.Location.X - 5, Panel6.Location.Y)
If Panel16.Location.X = pi + 50 Then
Timer15.Stop()
End If
ElseIf spost = 4 Then
Panel16.Location = New Point(Panel16.Location.X, Panel16.Location.Y + 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y - 5)
If Panel16.Location.Y = pi + 50 Then
Timer15.Stop()
End If
ElseIf spost = 1 Then
Panel16.Location = New Point(Panel16.Location.X - 5, Panel16.Location.Y)
Panel6.Location = New Point(Panel6.Location.X + 5, Panel6.Location.Y)
If Panel16.Location.X = pi - 50 Then
Timer15.Stop()
End If
ElseIf spost = 2 Then
Panel16.Location = New Point(Panel16.Location.X, Panel16.Location.Y - 5)
Panel6.Location = New Point(Panel6.Location.X, Panel6.Location.Y + 5)
If Panel16.Location.Y = pi - 50 Then
Timer15.Stop()
End If
End If
End Sub
End Class
Nessun commento:
Posta un commento