0

I am creating visual studio add-in. I want to change the mouse cursor to wait while my plugin is running and set earlier mouse pointer after it finishes execution.

How to change the Cursor ?

4

1 回答 1

0

简单的方法 :

// class for managing waiting cursor
public class WaitCursor : IDisposable
{
    private Cursor previousCursor;

    public WaitCursor()
    {
        this.previousCursor = Mouse.OverrideCursor;

        Mouse.OverrideCursor = Cursors.Wait;
    }

    #region IDisposable Members

    public void Dispose()
    {
        Mouse.OverrideCursor = this.previousCursor;
    }

    #endregion IDisposable Members
}

然后,只需使用

using (WaitCursor wait = new WaitCursor())
{
    // code that will execute with wait cursor
}
于 2013-10-09T12:53:31.260 回答