VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Move a form without using API!

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

Rate Move a form without using API!



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


Download this snippet    Add to My Saved Code

Move a form without using API! Comments

No comments have been posted about Move a form without using API!. Why not be the first to post a comment about Move a form without using API!.

Post your comment

Subject:
Message:
0/1000 characters