Reputation: 124800
I work on an application that requires some fancy custom controls. Inheriting from the .net Control class has caused various problems and is making things harder as time goes on. I won't get into the specifics here, but I am creating my own light weight control architecture to avoid some of these problems. Things art working nicely, but I need to add drag and drop functionality into my architecture.
All of the methods that I have come up with so far seem messy and error prone. I am mimicking the .net Control class in many ways, and have used the .net reflector to great benefit, but I am having a problem figuring out how to make my drag events fire (DragDrop, DragEnter, DragLeave).
I just can't think of a clean way to fire off these events. Does anyone have any ideas?
So far, the best that I have come up with is to implement the IDropTarget interface and hope that my events will fire. They do not.
@tamberg: I read through that article and it is not really what I am looking for (thank you though). My problem is that I do not know how to implement the event system. For example, how do I know when a data object is being dragged over my custom control class? How can I raise these events (DragOver, DragDrop, etc)?
All of the controls in the example inherit from System.Windows.Forms.Control, which is what I am trying to avoid.
Upvotes: 0
Views: 2982
Reputation: 2017
Just a guess:
Windows Forms, Custom Controls Part 1: Mastering DragDrop (http://www.codeproject.com/KB/miscctrl/LANDragDrop.aspx)
Regards, tamberg
Upvotes: 2