簡體   English   中英

WaitCursor沒有出現在C#NET CF應用程序中

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM