drag-drop How?
-
I want to drag and drop files onto my usercontrol. I want to know which eventhandler to write in this case and how to get file info in that handler? Help please
This is a very simple thing to accomplish. Have you searched MSDN?? Some helpers: Control.AllowDrop - Gets or sets a value indicating whether the control can accept data that the user drags onto it. Control.DragDrop Event - Occurs when a drag-and-drop operation is completed. The event handler receives an argument of type DragEventArgs containing data related to this event. One of the properties of DragEventArgs is Data. Use it to get the IDataObject that contains the data associated with this event. Check for file drop, and use...
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
}Just look at this: MSDN link[^] This posting is provided "AS IS" with no warranties, and confers no rights. Alex Korchemniy