用于启用/禁用表单中所有控件的功能 [英] Function to Enable/Disable all controls in a form
本文介绍了用于启用/禁用表单中所有控件的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
你能提供一个功能来禁用/启用ac#.net窗体中的所有控件
请帮助!!!
Hi All,
Can you provide a function which disables/enables all controls in a c#.net Windows Form
Please help!!!
推荐答案
这里回答:
http://stackoverflow.com/questions/1676766/getting-controls-in-a -winform-to-disable-they [ ^ ]
查看Ed S的最高评分答案:
Answered here:
http://stackoverflow.com/questions/1676766/getting-controls-in-a-winform-to-disable-them[^]
See the top rated answer from Ed S:
// This code snippet is from the SO thread linked above (by Ed S)
void ChangeEnabled( bool enabled )
{
foreach ( Control c in this.Controls )
{
c.Enabled = enabled;
}
}
我使用队列和递归函数来获取所有控件。
我的解决方案就在这里: http://stackoverflow.com/a/22940027/929740 [ ^ ]
I use queue and recursive function to get all controls.
my solution is here : http://stackoverflow.com/a/22940027/929740[^]
将所有控件添加到面板和禁用/启用面板。
Add all controls to a panel and disable/enable panel.
这篇关于用于启用/禁用表单中所有控件的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文