Click here to Skip to main content
Click here to Skip to main content
Alternative Tip/Trick

Tagged as

Hourglass Mouse Cursor Always Changes Back to its Original Image. How?

, 28 Dec 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
With System.Windows.Forms it's not necessary to pass the owner. You can use static property Cursor.Current.I use the following class in my projects:public sealed class WaitCursor : IDisposable{ private Cursor _SavedCursor; public WaitCursor() { _SavedCursor =...
With System.Windows.Forms it's not necessary to pass the owner. You can use static property Cursor.Current.
 
I use the following class in my projects:
 
public sealed class WaitCursor : IDisposable
{
  private Cursor _SavedCursor;
  public WaitCursor()
  {
    _SavedCursor = Cursor.Current;
    Cursor.Current = Cursors.WaitCursor;
  }
  public void Dispose()
  {
    Cursor.Current = _SavedCursor;
  }
}
Usage:
using (new WaitCursor())
{
  // do something
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

SergeyT2
Software Developer
Russian Federation Russian Federation
No Biography provided

Comments and Discussions

 
GeneralSergey, I will accept the alternative as a simplified form o... PinmvpSAKryukov28-Dec-10 17:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.141022.1 | Last Updated 29 Dec 2010
Article Copyright 2010 by SergeyT2
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid