I have a panel on aform.
Does any1 know how to make it so the user can move the panel around the form with the mouse???
Thanks,
Bebandit
Printable View
I have a panel on aform.
Does any1 know how to make it so the user can move the panel around the form with the mouse???
Thanks,
Bebandit
This will do it...
Private myX As Int32
Private myY As Int32
Private Moving As Boolean
Private Sub Panel1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown
myX = e.X
myY = e.Y
Moving = True
End Sub
Private Sub Panel1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseUp
Moving = False
End Sub
Private Sub Panel1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove
If Moving = True Then
Dim myPoint As New Point
myPoint.X = Panel1.Location.X + (e.X - myX)
myPoint.Y = Panel1.Location.Y + (e.Y - myY)
Panel1.Location = myPoint
End If
End Sub