This topic created in 3527 days ago, the information mentioned may be changed or developed.
我在 form 中有很多 button 控件,大概思路知道用 foreach 来做,但是试了一下好像没效果,有没有大神给个 demo 看看
我的代码:
foreach (Control ctr in this.Controls)
{
if (ctr is Button)
{
ctr.enabled = false;
}
}
Supplement 1 · Oct 9, 2016
我的控件层级关系: form→TabControl→TabPage→GroupBox→Button
Supplement 2 · Oct 9, 2016
搞定了,是我逻辑错了
6 replies • 2016-10-10 12:50:29 +08:00
 |
|
1
qwertyiuop Oct 9, 2016
binding enable
如果不要取消态的话 直接设置 hitTestVisible ?
或者直接把所有 button 放在一个 grid 里面 直接控制 grid 的 hitTestVisible
好久没弄 c#了 说错了 见谅
|
 |
|
4
Hyeongo Oct 9, 2016 via iPhone
多写 html
|
 |
|
5
ifishman Oct 9, 2016 via Android
还没看到第 3 条附言就知道是哪里的问题了, button 的父级元素是 groupbox 诶
|
 |
|
6
yejinmo Oct 10, 2016
能在 V 站看到 C#的帖子。。真不容易啊
|