Export (0) Print
Expand All

Control.DragDrop Event

Occurs when a drag-and-drop operation is completed.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member DragDrop : IEvent<DragEventHandler,
    DragEventArgs>

The X and Y properties of the DragEventArgs are in screen coordinates, not client coordinates. The following line of Visual C# code converts the properties to a client Point.

Point clientPoint = targetControl.PointToClient(new Point(de.X, de.Y));
NoteNote

In versions earlier than .NET Framework 2.0, if you put a UserControl with DragEnter and DragDrop events on a Windows Form and drag and drop something onto the UserControl at design time, the DropDrop and DropEnter events are raised. However, when you close and reopen the solution, the DragEnter and DragDrop events are not raised again.

For more information about handling events, see Handling and Raising Events.

This code excerpt demonstrates using the DragDrop event. See the DoDragDrop method for the complete code example.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft