by Allon and Joey from the philippines (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 20th April 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Move a form without using API!
API Declarations
Dim mousebeforex As Integer
Dim mouseaftery As Integer
Dim mousebeforex As Integer
Dim mouseaftery As Integer
Private Sub form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
MousePress = 1
mousebeforex = X
mouseaftery = Y
End Sub
Private Sub form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If MousePress = 1 Then
frmMain.Top = frmMain.Top + Y - mouseaftery
frmMain.Left = frmMain.Left + X - mousebeforex
End If
End Sub
Private Sub form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
MousePress = 0
End Sub