I use own cursor for my WinForms application; class looks like
public class WaitCursor : IDisposable
{
private readonly Cursor _previousCursor;
private static Cursor CursorResource
{
get
{
// get custom cursor from resources here
}
}
private WaitCursor()
{
_previousCursor = Cursor.Current;
Cursor.Current = CursorResource;
}
public void Dispose()
{
Cursor.Current = _previousCursor;
}
}
and now it works fine when I use it.
But are there a way to override system wait cursor with this one for entire application?
I found that it is possible to override system wait cursor using
[DllImport("user32.dll")]
static extern bool SetSystemCursor(IntPtr hcur, uint id);
Are there the same trick for application-level only?
I have not probed, but if you set the Cursor.Current property and set the Application.UseWaitCursor , then you'll get what you want.
Also, you can check this example: http://www.blackbeltcoder.com/Articles/winforms/implementing-a-waitcursor-class
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.