开发者

WaitCursor doesn't appear in a C# NET CF application

开发者 https://www.devze.com 2023-03-05 05:11 出处:网络
I\'m running a somewhat lengthy process in a C# .NET CF application, then I want to show the hourglass mouse pointer. The code I\'m using is:

I'm running a somewhat lengthy process in a C# .NET CF application, then I want to show the hourglass mouse pointer. The code I'm using is:

Cursor.Current = Cursors.WaitCursor;
Cursor.Show();
this.Refresh();

for (int nRow = 0; ... // lengthy pr开发者_Go百科ocess
{
    Program.tblLect.Rows[nRow]["rowId"] = nRow + 1;
    // tried with this, doesn't work either
    //if ((nRow % 20)==0) 
    //    Application.DoEvents();
}

Cursor.Current = Cursors.Default;

but no cursor is shown in the form.

Any ideas?


Even when calling Application.DoEvents, your application will be working ALOT and therefore is not guaranteed to update the UI. Try and keep the load off your GUI thread. For the test, just run your code on a background thread.


Instead of Cursor.Current use

this.Current=Cursors.Waitcusrsor;

this.Cursor=Cursors.Default;

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号