Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change mouse cursor when handling drag (from DragOver event)? [duplicate]

We need to display a feedback to the user when he drags-in items into our application. Our client prefers this feedback to be in form of a custom cursor.

This is already implemented for drag-out, using a custom cursor that is set in GiveFeedback event handler (raised by DoDragDrop when dragging items out of our app). The GiveFeedbackEventArgs allows us to specify UseDefaultCursors property - setting this to false allows us to override the cursor.

However, the DragOver event handler argument, which is the equivalent of GiveFeedback, does not have UseDefaultCursors property and changing the cursor from there does not have any effect.

Sample (this has no effect):

private void browser_DragOver(object sender, DragEventArgs e) {
  Cursor.Current = Cursors.WaitCursor;
}

The drag operation originates from outside our app. (for in-app drag, it works using the GiveFeedback event.

How to change the cursor when receiving a drag? Is this even possible/feasible?

like image 773
Marek Avatar asked Dec 27 '25 21:12

Marek


1 Answers

void Form1_GiveFeedback(object sender, GiveFeedbackEventArgs e) {
    e.UseDefaultCursors = false;
}
like image 154
Barrakoda Avatar answered Dec 30 '25 09:12

Barrakoda



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!