7. April 2011

How do I change the mouse cursor to a hourglass?

... in a dotnet Form?


Das ist die leichte Frage ;)


this.Cursor = Cursors.WaitCursor;

To change it back to normal after the application has stopped loading:


this.Cursor = Cursors.Default;

As IntelliSense points out, you can change the mouse cursor to various shapes (crosshair, hand, help, etc.).




... gut, wie gesagt, das war leicht ;)
Aber wie sieht das Ganze aus, wenn man das aus einer statischen Methode machen möchte oder eben außerhalb eines .net control containers?



Cursor.Current = Cursors.WaitCursor; 
Cursor.Current = Cursors.Default;

(wie üblich in VC++ .net werden aus . einfach :: )


oder alternativ:

Application.UseWaitCursor = true;
// Do stuff
Application.UseWaitCursor = false;

... okay, das war jetzt auch nicht viel schwerer xD

Ich hoffe, wenigstens iiiiirgendwem damit geholfen zu haben
und sei es bloß mir selbst, wenn ich das wieder mal vergessen sollte und nachschlagen möchte ^^


happy coding
incredible Leitman

Keine Kommentare: