Drag and drop

G

George

Hi.
I try to program a drag and drop procedure as follows:
I have a windows form with a panel which plays thw role of the target.
I have a second window form over the previous which plays the role of tools
palette.
I have a usercontrol which is contained in the palette form with DragAndDrop
Effects Copy or Move

(DoDragAndDrop(this, DragDropEffects.Copy | DragDropEffects.Move)

I program the DragEnter Event as follows

private void panel1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy|DragDropEffects.Move;
}

I want when the user drags the user control from the palette window, this to
be copied in the panel but when the user drags the usercontrol from the
panel, this to be moved (without pressing any other key). How can I
distinguish the two operations (the two modes) so I can write code in order
the control to be moved when the dragging starts from the inside panel and
to be copied when the dragging starts outside the panel.

How can I change the "e.effect" from the panel when the control is already
inside the panel?

Thank you
George
 
K

Kevin Spencer

Since the user can only drag one object, all you have to do is create a
global variable whose value you set when the drag begins.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 

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