2021
04-27
04-27
C# WinForm遍历窗体控件的3种方法
1.循环遍历privatevoidGetControls(ControlfatherControl){Control.ControlCollectionsonControls=fatherControl.Controls;foreach(ControlcontrolinsonControls){listBox1.Items.Add(control.Name);}}结果:能获取到Panel、GroupBox、TabControl等控件问题:Panel等控件上面的子控件获取不到2.递归遍历privatevoidGetControls(ControlfatherControl){Control.ControlCollectionsonCont...
继续阅读 >