c# - WaitCursor 没有出现在 C# NET CF 应用程序中

标签 c# compact-framework

我在 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/

相关文章:

.net - CE 5.0 Compact Framework .NET 上的 DataGrid 是否支持编辑?

.Net Compact Framework 滚动条 - 垂直显示时始终显示水平

c# - c#紧凑框架中的Directshow : trigger handling problems for a Filtergraph's IMediaEvent

c# - 如何使用 C# 在 Windows CE 中将 SQL Server Compact 表导出到 Excel?

c# - 事件处理程序中的功能代码不好的做法?

c#:如何使用默认空格+一组附加分隔符拆分字符串?

c# - C# 函数参数中的方括号语法?

c# - 如何过滤 Telerik 的 RadGrid 的 GridTemplateColumns

c# 从 PDF 中读取行

c# - 按 ASC 顺序按值对哈希表进行排序