我在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;但是在窗体中没有显示光标。
有什么想法吗?
发布于 2011-05-12 23:34:16
即使在调用Application.DoEvents时,您的应用程序也会大量工作,因此不能保证更新UI。试着把负载从你的GUI线程上移开。对于测试,只需在后台线程上运行代码即可。
发布于 2019-01-04 15:22:22
不使用Cursor.Current
this.Current=Cursors.Waitcusrsor;
this.Cursor=Cursors.Default;
https://stackoverflow.com/questions/5980292
复制相似问题