How do I implement a fully customizable drag and drop control?

I am working on an application that requires some custom custom controls. Inheriting from the .net Control class has caused various problems and complicates things over time. I won't go into details here, but I am building my own lightweight architecture to avoid some of these problems. Everything works well, but I need to add drag and drop functionality to my architecture.

All of the methods I have come up with so far seem to be messy and error prone. I mimic the .net control class in many ways and have used the .net reflector to a great extent, but I am having trouble figuring out how to make my drag events (DragDrop, DragEnter, DragLeave).

I just can't think of a way to clear these events. Does anyone have any idea?


So far, the best I've come up with is to implement the IDropTarget interface and hope my events fire. They don't.


@tamberg: I ​​read this article and this is not what I'm looking for (thank you). My problem is that I don't know how to implement the event system. For example, how do I know when a data object is being dropped over my custom management class? How can I raise these events (DragOver, DragDrop, etc.)?

All controls in the example inherit from System.Windows.Forms.Control, which I am trying to avoid.

0


source to share


1 answer


Just guess:

Windows Forms Custom Controls Part 1: Mastering DragDrop ( http://www.codeproject.com/KB/miscctrl/LANDragDrop.aspx )



Regards, Tamberg

+2


source







All Articles