Dav*_*ngs 1 c# forms non-modal
在一段可能需要几秒钟才能完成的C#代码的开头,我想显示一个带有标签的非模态表单,上面写着"请稍等......"
WaitForm myWaitForm = null;
try
{
// if conditions suggest process will take awhile
myWaitForm = new WaitForm();
myWaitForm.Show();
// do stuff
}
finally
{
if (myWaitForm != null)
{
myWaitForm.Hide();
myWaitForm.Dispose();
myWaitForm = null;
}
}
Run Code Online (Sandbox Code Playgroud)
问题:在其余代码占用线程之前,WaitForm没有完全显示.所以我只看到表格的框架.在Delphi(我的旧st脚)中,我会在Show()之后调用Application.ProcessMessages在C#中是否有等价物?我可以在这样的情况下使用罐装"状态"表格吗?有没有更好的方法来解决这个问题?
提前致谢.大卫詹宁斯
| 归档时间: |
|
| 查看次数: |
706 次 |
| 最近记录: |