简体   繁体   English

冻结用户界面c#winforms

[英]freezing user interface c# winforms

I have a question. 我有个问题。 Did exists function which disabling all controls at interface? 是否存在禁用接口所有控件的功能? I have a lot of controls and I don`t want do this control after control. 我有很多控件,我不想在控制后做这个控制。 I writing a program in WinForms. 我在WinForms中编写程序。 Thanks for helps 谢谢你的帮助

Sure you can, in your Form code behind just write: 当然你可以在你的表单代码后面写一下:

this.Enabled = false;

In the point you want to disable the WHOLE interface. 在您要禁用WHOLE接口的位置。 Be careful though, this will prevent even the window from closing using the "X" button. 但要小心,这样可以防止窗口关闭,使用“X”按钮。 To prevent that you could just simply move all the controls in your interface inside a Container (like a Panel, GroupBox or whatever), name it (eg Panel1) and then use Panel1.Enable = false to disable that container together with all his childrens. 为了防止你只是简单地移动你的接口内的所有控件(如Panel,GroupBox或其他),命名它(例如Panel1),然后使用Panel1.Enable = false来禁用该容器及其所有孩子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM