Drag and drop

  • Thread starter Thread starter George
  • Start date Start date
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
 
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
 
Back
Top