Setting Cursor property has no effect (C#)

Posted by Knarf Navillus on Stack Overflow See other posts from Stack Overflow or by Knarf Navillus
Published on 2010-04-03T20:06:16Z Indexed on 2010/04/03 20:13 UTC
Read the original article Hit count: 168

Filed under:
|
|

Hello,

I have a class that I've derived from System.Windows.Forms.Panel, and my application has a main form with one of these panels. On the whole, the panel works great! The only thing I'm having trouble with is setting the cursor. Whether I'm setting it to one of the static members of the Cursors class (Default, WaitCursor, etc.) or setting it to a custom cursor that I've loaded from a resource, the end result is the same: it does nothing. I still see the default mouse pointer, no matter what. This line of code is inside a method of my panel-derived class:

this.Cursor = Cursors.WaitCursor;

I can set a break point there, and see that this line is being hit when I expect it to. I've also created an override for the OnCursorChanged method, and set a breakpoint in there just to see if it's being triggered. I can verify that both breakpoints are being hit when I expect them to. However, the cursor just never changes. There must be something that I'm missing. Does anyone have any ideas?

P.S. I also did try setting Current.Cursor as well, however that did not help.

© Stack Overflow or respective owner

Related posts about c#

Related posts about cursor