[英]WaitCursor doesn't appear in a C# NET CF application
我在C#.NET CF应用程序中运行了一个漫长的过程,然后我想显示沙漏鼠标指针。 我使用的代码是:
Cursor.Current = Cursors.WaitCursor;
Cursor.Show();
this.Refresh();
for (int nRow = 0; ... // lengthy process
{
Program.tblLect.Rows[nRow]["rowId"] = nRow + 1;
// tried with this, doesn't work either
//if ((nRow % 20)==0)
// Application.DoEvents();
}
Cursor.Current = Cursors.Default;
但表格中没有显示光标。
有任何想法吗?
即使在调用Application.DoEvents时,您的应用程序也可以正常运行,因此不能保证更新UI。 尝试减轻您的GUI线程的负担。 对于测试,只需在后台线程上运行代码即可。
代替Cursor.Current使用
this.Current = Cursors.Waitcusrsor;
this.Cursor = Cursors.Default;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.