2010-07-22 37 views

回答

3

像這樣的事情是有點用的:

class WaitCursor : IDisposable 
{ 
    public WaitCursor() 
    { 
     Cursor.Current = Cursors.WaitCursor; 
    } 

    public void Dispose() 
    { 
     Cursor.Current = Cursors.Default; 
    } 
} 

它使您可以使用「使用」塊返回到默認光標,即使你有一個異常或返回:

public Foo() 
{ 
    using (var c = new WaitCursor()) 
    { 
     // do long-running stuff 
     // when we exit the using block, the cursor will return to the default state 
    } 
} 
1

你的意思是等待光標?

using System.Windows.Forms; 
Cursor.Current = Cursors.WaitCursor; 
相關問題