我在按钮点击事件中有以下代码:
try
{
Cursor = Cursors.WaitCursor;
GenerateReports();
}
finally
{
Cursor = Cursors.Default;
GC.Collect();
GenPacketBtn.Enabled = true;
}
光标只有在finally块中才会被设置回默认值,但是由于某些原因它可能会“累了”并恢复为其默认状态。为什么会这样,并且我该如何确保它不会停止“等待”,直到所有进程的大头儿子(GenerateReports())完成?
GenerateReports()
之前加入Thread.Sleep
是否可以延长这段时间呢? - Matthew Haugen