Display Wait Cursor


Set Form window cursor to wait cursor

Wait Cursor is used to increase user responsiveness.
Mouse cursor displayed over any control in windows forms application is determined by Control.Cursor property. If you want to change the mouse cursor at application level use static property Current of Cursor class. To show hourglass cursor assign value Cursors.WaitCur­sor. To return back the default behavior (to display control specific cursor) assign back value Cursors.Default to the Cursor.Current property.



//To show wait cursor while executing any event
//Add below code at the beginning of event
Cursor.Current = Cursors.WaitCursor;
try
{
Thread.Sleep(5000); // wait for a while
}
finally
{
//Add this code to hide wait cursor after excution of whole event code.
Cursor.Current = Cursors.Default;
}


Comments

Author: praveen15 Sep 2010 Member Level: Gold   Points : 0

nice



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: