CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 19

Threaded View

  1. #6
    Join Date
    Nov 2005
    Posts
    95

    Re: dragr frames at run time

    WOF:

    I took your thoughts and came up with the following (the frame is intialized to dragMode=Manual)
    This works very well....EXCEPT you have to move the frame a large distance before the form dragDrop will fire on mouse release...so if you need a minor position adjustment you have to set down the frame far away then pull it back into desired position...how come?

    Code:
    Private Sub Frame1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Mx = X
    My = Y      'grab mouse coordinates
    Frame1.DragMode = 1    '(automatic)
    Frame1.Drag                   'start dragging NOW
    End Sub
    '.....
    '.....
    Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
    Source.Move X - Mx, Y - My  'final resting spot
    Source.DragMode = 0         'back to manual (no dragging)
    End Sub
    Last edited by vbcandies; January 7th, 2010 at 12:31 AM.

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

Featured