select more controls before drag and drop

K

KS

I have a form where I want to drag and drop some buttons.

It works fine with one button but I want to select more than just the one
button I first drag.

How can I select more buttons and then drag and drop them all ?

The buttons are just controls on a form.

KS, Denmark
 
P

Philip Rieck

If you are talking about drag-drop in the VS.NET designer, then you can just
hold down the Control key while selecting multpile controls to drag-drop.
If that's the case, then you probably should post questions like these in
microsoft.public.vsnet.ide or microsoft.public.vsnet.general in the future.

If you're doing this at runtime, then I can't really answer your question
yet. Can you post the code you are currently using to allow the user to
select the buttons for drag-drop, and the code you're using to initiate it?
 
K

KS

If you're doing this at runtime, then I can't really answer your question
yet. Can you post the code you are currently using to allow the user to
select the buttons for drag-drop, and the code you're using to initiate
it?

It IS at run-time !

Mu code is too huge to be posted here, but its based on the standard
"DragDrop-way"

I'll see if I can make a minimized sample code to upload.

KS, Denmark
 
K

KS

Here is a sample code.

Make a form with 3 buttons - Button1, Button2, Button3
Make the FORM-property AllowDrop=True
Insert this code:

from her ---------------------------------------
Dim GripOffset As Point
Private Sub btnMouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) _
Handles Button1.MouseDown, Button2.MouseDown, Button3.MouseDown
If e.Button = MouseButtons.Left Then
GripOffset.X = e.X
GripOffset.Y = e.Y
sender.DoDragDrop(sender, DragDropEffects.All)
End If
End Sub
Private Sub frmDragEnter(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) _
Handles MyBase.DragEnter
If e.Data.GetDataPresent("System.Windows.Forms.Button") Then
e.Effect = DragDropEffects.Copy
End If
End Sub

Private Sub frmDragDrop(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) _
Handles MyBase.DragDrop
Dim DroppedObj As Button = e.Data.GetData("System.Windows.Forms.Button")
Dim NPos As New Point()
NPos = Me.PointToClient(MousePosition)
NPos.Offset(-GripOffset.X, -GripOffset.Y)
DroppedObj.Location = NPos
End Sub
To here -------------------------------------

hmmm ...(is it all ??) .... now (I think), when you run the program you
should be able to dragNdrop the buttons - OK ?

BUT only 1 button at a time - I want to select two or all tree and dragNdrop
them at one time - but HOW ?

KS, Denmark
 
N

naseebcmr

Yes...
let me try that....but i should get to know how u implemented for one command button....send me the code...and we both can think over it...


Nas


**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top