且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 C# 中显示窗体的所有隐藏控件?

更新时间:2023-10-03 20:55:04

你可以让它递归,然后如果你有任何面板/组框,他们的孩子也可以看到.

You could make it recursive, then if you have any panels/group boxes their children get made visible too.

public void MakeVisible(Control control)
{
    if(control.HasChildren)
    {
        foreach (Control child in control.Controls)
        {
            MakeVisible(child);
        }
    }
    control.Visible = true;
}