Drag a Form without the cursor jumping to 0-0 on the form. Pure Math solution. No API call required
Drag a Form without the cursor jumping to 0-0 on the form. Pure Math solution. No API call required.
API Declarations
Dim LocatorX As Integer
Dim LocatorY As Integer
Dim XSpace As Integer
Dim YSpace As Integer
Rate Drag a Form without the cursor jumping to 0-0 on the form. Pure Math solution. No API call required
(1(1 Vote))
MouseEvent = 1
LocatorX = X
LocatorY = Y
XSpace = Int(X - (Y / Form1.Height))
YSpace = Int(Y - (X / Form1.Width))
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If MouseEvent = 1 Then
Form1.Top = Form1.Top + Y - YSpace
Form1.Left = Form1.Left + X - XSpace
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseEvent = 0
End Sub
Drag a Form without the cursor jumping to 0-0 on the form. Pure Math solution. No API call required Comments
No comments yet — be the first to post one!
Post a Comment