在waitcursor运行时防止用户交互 [英] Prevent user interaction while waitcursor is running

查看:118
本文介绍了在waitcursor运行时防止用户交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows Mobile应用程序中,我具有执行一些异步代码的形式.我想在启动时显示一个等待光标,并在完成时隐藏它.
使用:
,该部分效果很好. 方法开始
Cursor.Current = Cursors.WaitCursor;
和方法结尾
Cursor.Current = Cursors.Default;


我还想防止用户与我表单上的控件进行交互,而
显示等待光标,以便使用事件(调整大小和取消除外)
被阻止.在C#.NET中建议这样做的方法是什么?

In windows mobile application I have a form which performs some asynchronous code. I want to display a wait cursor when it starts, and hide the wait cursor when it has completed.
This part works fairly well, using:
method starting
Cursor.Current = Cursors.WaitCursor;
and method ending
Cursor.Current = Cursors.Default;


I also want to prevent user interaction with the controls on my form while
the wait cursor is displayed, so that use events (except resize and cancel)
are blocked. What is the recommended way of doing this in C#.NET?

推荐答案

您可以禁用所有类似的控件:
You can disable all the controls like this :
foreach(Control c in this.Controls)
    c.Enabled= false;
btnCancel.Enabled=true;


这篇关于在waitcursor运行时防止用户交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆