[Code Sample]: Moveable Controls 04-21-2020, 08:43 PM
#1
This code will allow the user to move any controls linked to this code
Preview:
![[Image: move-obj.gif]](https://i.ibb.co/B2WsN8Z/move-obj.gif)
Sample:
Preview:
![[Image: move-obj.gif]](https://i.ibb.co/B2WsN8Z/move-obj.gif)
Sample:
Code:
Dim X, Y, point
Private Sub %ControlName%_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles %ControlName%.MouseMove
If e.Button = MouseButtons.Left Then
point = Control.MousePosition
point.X = Me.point.X - Me.X
point.Y = Me.point.Y - Me.Y
sender.Location = point
End If
End Sub
Private Sub %ControlName%_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles %ControlName%.MouseDown
X = Control.MousePosition.X - sender.Location.X
Y = Control.MousePosition.Y - sender.Location.Y
End Sub







![[+]](https://sinister.li/images/modern/collapse_collapsed.png)

