MoveForm




Public LastX as Single'Build a reference to the last X Cursor Coordinate
Public LastY as Single'Build a reference to the last Y Cursor Coordinate
Private Sub Form_MouseDown(Button As Integer, _
Shift As Integer, X As Single, Y As Single)
'Make The MousePointer On Form Look Like All Sizing.

Me.MousePointer = vbSizeAll
LastX = X'Capture the Current X Coordinate To LastX Variable.
LastY = Y'Capture the Current Y Coordinate To LastY Variable.
End Sub

'To make the form Moves, simply do this.

Private Sub Form_MouseMove(Button As Integer, _
Shift As Integer, X As Single, Y As Single)
Dim BX as Single, BY as Single
Screen.MousePointer = vbNormal
If Button = 1 Then'Assuming The Left Button Is The Way To Moves It.
BX = X - LastX: By = BY - LastY
Me.Move Me.Left + bx, Me.Top + By
End If
End Sub











( moveform.html )- by Paolo Puglisi - Modifica del 17/12/2023