c# 怎么在代码中对所有button控件操作啊小弟我想数组,但如何搞
c# 如何在代码中对所有button控件操作啊,我想数组,但怎么搞
RT
------解决方案--------------------
RT
------解决方案--------------------
- C# code
List<Button> btns = new List<Button>(); btns.Add(button1);
------解决方案--------------------
- C# code
List<Button> btns = new List<Button>(); foreach (Control control in Controls) { if (control is Button) { btns.Add(control); } }
------解决方案--------------------
- C# code
List<Button> btns = new List<Button>(); foreach (Control control in Controls) { if (control is Button) { btns.Add(control as Button); } }