|
-
May 5th, 2003, 11:33 AM
#1
Thread Starter
New Member
drag control using mouse
i am interested to move a panel control in a form by mouse dragging. how is this possible in vb.net?
this is with moving a control on a form by mouse dragging and not the contents of a control.
any help on this highly appreciated
-
May 5th, 2003, 12:35 PM
#2
Fanatic Member
This should work for any control, does for panel and button:
Code:
Private Sub Panel1_MouseMove(ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles Panel1.MouseMove
If e.Button = MouseButtons.Left Then
sender.Top = sender.Top + e.Y
sender.Left = sender.Left + e.X
End If
End Sub
although if you are working with a container that has children controls, I don't see how (or why) you would leave the children controls behind. Contents of the control are going along for the ride unless you want to take them out of the controlscollection of the control you want to move.
-
May 5th, 2003, 02:45 PM
#3
Thread Starter
New Member
Thanks! I will try this as soon as i reach home.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|