我在 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 线程的负担。对于测试,只需在后台线程上运行您的代码。
关于c# - WaitCursor 没有出现在 C# NET CF 应用程序中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5980292/