Custom cursor in during DragDrop

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I need to change the cursor generated by the effect given on the DoDragDrop
method, when drag drop is started. I want to put something like in windows
explorer an image under the cursor or something like that, not only the
simple dragdrop cursor (the copy, move, or whatever) I tried changing the
cursor on the dragover event, but wont override the current given by the
effect.

can someone help me with this issue?
 
The DragOver event is only raised when something is dragged over a control
that has its AllowDrop property set to true. But that isn't relevant here.

To change the default cursors in the drag-and-drop behavior, you need to
subscribe to the GiveFeedback method of the source control. The
GiveFeedbackEventHandler delegate provides you with a reference to a
GiveFeedbackEventArgs object which exposes a UseDefaultCursor property. Set
this property to false and set the desired cursor like so:

e.UseDefaultCursors = false;
Cursor.Current = Cursors.Hand; // or whatever you want the cursor to be

I have an upcoming MSDN article that will demonstrate some advanced
drag-and-drop techniques. If this is something that is urgent, let me know
and I'll send you the draft and/or the code.
 
Back
Top