Wait cursor

Getting the nice colorful system-is-busy hourglass (or whatever it is) to appear is extremely simple:

Cursor.Current = Cursors.WaitCursor;

Note that the animation will stay put until you change it back to Default, so it is a good idea to put it in a finally clause to make sure it happens:

try {
 Cursor.Current = Cursors.WaitCursor;
 //Do something time consuming…
}
finally {
 Cursor.Current = Cursors.Default;
}

In this way, even if you get an exception the cursor will switch back (this is a good idea for standard Windows Forms programming also btw)

Edit: The Cursor property is not on the form, but on System.Windows.Forms, changed the reference

Advertisements

4 Responses to Wait cursor

  1. Veishenna says:

    Interesting blogpost, did not thought reading it would be so cool when I looked at your title with link!!

  2. Bernardo Rosmaninho says:

    Very nice tutorial… simple and objective!
    Congrats!

    -_- >>> better than microsoft one! lol !

  3. Anonymous says:

    Excellent! Really! Just what I needed! Very simple and direct! I’ll add this blog to my favorites

  4. Mobile says:

    Mobile…

    […]Wait cursor « Mobiledeveloper[…]…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: