1.代码:
List<Control> LControls = new List<Control>();
private void getControls(Control fatherControl)
{
Control.ControlCollection sonControls = fatherControl.Controls;
//遍历所有控件
foreach (Control control in sonControls)
{
LControls.Add(control);
if (control.Controls != null)
{
getControls(control);
}
}
}