Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make mouse with busy icon (C#) [duplicate]

I have an application that takes a couple of seconds to run. Is it possible to make the mouse with the busy icon while the app is processing?

like image 647
mouthpiec Avatar asked Mar 25 '10 15:03

mouthpiec


People also ask

How do I change my cursor in Winforms?

Current = new Cursor("C:\\ic. cur");


2 Answers

Use Cursor.WaitCursor property.

You can use:

Cursor.Current = Cursors.WaitCursor;

and as long as there is some processing going on in a WinForms application, the cursor stays in the WaitCursor state.

You can as well use your custom designed cursors:

Cursor.Current = new Cursor("C:\\Cursors\\MyWait.cur");

source: http://bytes.com/topic/c-sharp/answers/238623-how-change-mouse-cursor-busy-state

like image 74
XpiritO Avatar answered Nov 15 '22 09:11

XpiritO


You need to set the form's UseWaitCursor property to true. (And remember to set it to false again afterwords, preferably in a finally block)

You can also set Application.UseWaitCursor to true to apply it to every form.

like image 34
SLaks Avatar answered Nov 15 '22 10:11

SLaks