Hourglass Cursor [C#]
This example demonstrates how to show hourglass in C#.
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.WaitCursor. To return back the default behavior (to display control specific cursor) assign back value Cursors.Default to the Cursor.Current property. See example below.
[C#]// hourglass cursor Cursor.Current = Cursors.WaitCursor; try { Thread.Sleep(5000); // wait for a while } finally { Cursor.Current = Cursors.Default; }
See also
- [C#] Topmost Form at Application Level – don't overlap other application forms
- [C#] InputBox – simple static method to show InputBox in C#
- [C#] InputBox With Value Validation – improved InputBox class
- [C#] Separator Line on Form – simulate a bevel line on form
- [C#] Set DoubleBuffered Property – set protected property Control.DoubleBuffered
- [C#] Autoscroll (TextBox, ListBox, ListView) – autoscroll in common controls