Private Sub player2Label_MouseDown1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles player2Label.MouseDown
'check if it's the left button pressed
If e.Button = Windows.Forms.MouseButtons.Left Then
'store the mouse co-ords
x = e.X
y = e.Y
End If
End Sub
Private Sub player2Label_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles player2Label.MouseMove
'only update if left button is still pressed
If e.Button = Windows.Forms.MouseButtons.Left Then
'work out the labels new x position
If e.X > x Then
player2Label.Left += e.X - x
Else
player2Label.Left -= x - e.X
End If
'work out the label new y position
If e.Y > y Then
player2Label.Top += e.Y - y
Else
player2Label.Top -= y - e.Y
End If
End If
End Sub
Private Sub player3Label_MouseDown1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles player2Label.MouseDown
'check if it's the left button pressed
If e.Button = Windows.Forms.MouseButtons.Left Then
'store the mouse co-ords
x = e.X
y = e.Y
End If
End Sub
Private Sub player3Label_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles player2Label.MouseMove
'only update if left button is still pressed
If e.Button = Windows.Forms.MouseButtons.Left Then
'work out the labels new x position
If e.X > x Then
player3Label.Left += e.X - x
Else
player3Label.Left -= x - e.X
End If
'work out the label new y position
If e.Y > y Then
player3Label.Top += e.Y - y
Else
player3Label.Top -= y - e.Y
End If
End If
End Sub