Drag and Drop in C#
-
Hello, I implemented drag and drop for some of my controls. I did it by having my controls implement IDataObject then using the usual mouse(up,down, move, etc) and drag(drop, leave, etc) events, in other controls/forms to accept the drop. While the control is being dragged its shown along with the mouse as a small square border with a small + sign next to it (I guess this is default). It looks like the small box is the representation of the control being dragged. I would like to show sometime else as the control is being dragged. I've been looking on MSDN and online and didn't find anything yet (they only talked about how to replace the mouse cursor for the drag operation). I really would like to avoid creating a form and moving that around with the mouse. Is there some handle to replace the default "object being dragged" state/box with something of my own choice. Thanks, Ramanan
"One of the Georges," said Psmith, "I forget which, once said that a certain number of hours' sleep a day--I cannot recall for the moment how many--made a man something, which for the time being has slipped my memory."
-
Hello, I implemented drag and drop for some of my controls. I did it by having my controls implement IDataObject then using the usual mouse(up,down, move, etc) and drag(drop, leave, etc) events, in other controls/forms to accept the drop. While the control is being dragged its shown along with the mouse as a small square border with a small + sign next to it (I guess this is default). It looks like the small box is the representation of the control being dragged. I would like to show sometime else as the control is being dragged. I've been looking on MSDN and online and didn't find anything yet (they only talked about how to replace the mouse cursor for the drag operation). I really would like to avoid creating a form and moving that around with the mouse. Is there some handle to replace the default "object being dragged" state/box with something of my own choice. Thanks, Ramanan
"One of the Georges," said Psmith, "I forget which, once said that a certain number of hours' sleep a day--I cannot recall for the moment how many--made a man something, which for the time being has slipped my memory."
You can replace the cursor with whatever you like, the Bitmap class has a GetHIcon method, or something like that, which converts it to an icon, which can then be passed to the Cursor constructor.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
You can replace the cursor with whatever you like, the Bitmap class has a GetHIcon method, or something like that, which converts it to an icon, which can then be passed to the Cursor constructor.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
Thanks Christian, I also found a sample for this same method in Chris Sell's new Windows Forms book in an Appendix last evening.
"One of the Georges," said Psmith, "I forget which, once said that a certain number of hours' sleep a day--I cannot recall for the moment how many--made a man something, which for the time being has slipped my memory."