views:

58

answers:

2

Hi All

I have a question about drag and drop in WinForms. I know how to enable the user to drag and drop controls around inside the form, but what I'm now trying to do is enable them to drag a LinkLabel ontop of a"Recycle Bin" icon inside my Form and when it detects that something has been dropped onto the Recycle Bin icon, that control will be removed from the Form.

How would I detect if something's been dropped on another control? Would I still use Control.DragEnter & Control.DragDrop?

Thank you

+2  A: 

yes, DragEnter and DragDrop is the right way to go, also you need to handle DragOver.

Typically, in these handler you specify what kind of drag-drop is allowed, and in DragDrop do your staff of deleting.

Benny
thanks heaps benny
baeltazor
A: 

Here is the helpful link for you which can explain you about the DragDrop. http://www.codeproject.com/KB/combobox/LarryDragAndDrop.aspx

You require to work on following Events: 1. MouseDown    2.DragEnter   3. DragDrop

Shivkant