private void PrintChildControls(Control control)
{
foreach (Control child in control.Controls)
{
Console.WriteLine(child.Name);
PrintChildControls(child); // 递归遍历子控件
}
}
private void button1_Click(object sender, EventArgs e)
{
PrintChildControls(this);
}