Results 1 to 5 of 5

Thread: [RESOLVED] How to move a frame like a form in run time with mouse click and drag?

  1. #1

    Thread Starter
    Addicted Member senthilkumartd's Avatar
    Join Date
    Feb 2005
    Posts
    206

    Resolved [RESOLVED] How to move a frame like a form in run time with mouse click and drag?

    Hi,
    How to move a frame like a form in run time with mouse click and drag?

    I tried the following coding but it is not working? Any idea?

    In module,

    VB Code:
    1. Public Type Position
    2.     X As Single
    3.     Y As Single
    4. End Type

    In form,

    VB Code:
    1. Dim Clicked As Position
    2.  
    3. Private Sub Frame1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    4. Clicked.X = X
    5. Clicked.Y = Y
    6. End Sub
    7.  
    8. Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    9. If Clicked.X <> 0 Or Clicked.Y <> 0 Then
    10.     Frame1.Left = Frame1.Left + (X - Clicked.X)
    11.     Frame1.Top = Frame1.Top + (Y - Clicked.Y)
    12.     Clicked.X = X
    13.     Clicked.Y = Y
    14. End If
    15. End Sub

  2. #2

  3. #3

    Thread Starter
    Addicted Member senthilkumartd's Avatar
    Join Date
    Feb 2005
    Posts
    206

    Re: How to move a frame like a form in run time with mouse click and drag?

    thanks

  4. #4
    New Member
    Join Date
    Jan 2016
    Posts
    1

    Re: [RESOLVED] How to move a frame like a form in run time with mouse click and drag?

    Hi,

    instead of Frame1_MouseMove you should use Frame1_MouseUp event

    thanks

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Re: [RESOLVED] How to move a frame like a form in run time with mouse click and drag?

    This thread is nine years old. The people have likely moved on to new things. Therefore, I closed it.
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width