我有一个需要几秒钟才能最终显示的表单。此表单通过以下方式调用:
using (ResultsForm frm = new ResultsForm())
{
this.Visible = false;
frm.ShowDialog();
this.Visible = true;
}
Cursors.WaitCursor
在等待表单最终显示时获得默认光标非常有用。目前,我似乎只能通过使用静态“当前”属性成功地做到这一点:
using (ResultsForm frm = new ResultsForm())
{
//this.Visible = false;
Cursor.Current = Cursors.WaitCursor;
frm.ShowDialog();
//this.Visible = true;
}
但这有两个问题:
- 它迫使我禁用我想保留的 MainForm 隐藏功能。
- 它增加了耦合,因为
Cursor.Current = Cursor.Default;
需要在 ResultsForm Shown 事件中调用。
如何在表单加载时更改光标而不更改第一个代码段并避免耦合?
更新: 现在问题得到了回答,视频演示被删除了,所以我不会超过我的 ISP 带宽限制。