VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Move the form by dragging a control, with only one event...MouseMove

by Anonymous (267 Submissions)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 24th January 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Move the form by dragging a control, with only one event...MouseMove

API Declarations



'You may rename "Label1" to whatever the control is called in the form. It will
'only move the parent form, not others. It only accepts the Left mouse button.

'To test this example, create one label named "Label1" on a form, start the
'program, then drag that label.


Rate Move the form by dragging a control, with only one event...MouseMove



    Dim CurX As Single
    Dim CurY As Single
    Dim MovX As Single
    Dim MovY As Single
    
    If Button = 1 Then
        MovX = x - CurX
        MovY = y - CurY
        Left = Left + MovX
        Top = Top + MovY
    Else
        CurX = x
        CurY = y
    End If
End Sub

Download this snippet    Add to My Saved Code

Move the form by dragging a control, with only one event...MouseMove Comments

No comments have been posted about Move the form by dragging a control, with only one event...MouseMove. Why not be the first to post a comment about Move the form by dragging a control, with only one event...MouseMove.

Post your comment

Subject:
Message:
0/1000 characters