Yuk*_*uya 0 .net c# installer panel
编辑
我找到并发布了解决方案.
我正在尝试为我的应用程序创建一个安装程序,我正在尝试使用面板(我不知道这是否是一个很好的方法,但这给了我更多的自定义选项,而不是使用安装盾程序) .最好的方法是什么?
这是我知道的代码:
C#代码
foreach (Control c in Controls)
{
if (c is Panel)
{
if (c.Name != "pnlBottom")
{
if (c.Name.Contains(_currentPanel.ToString()))
{
c.Visible = true;
return;
}
else
{
c.Visible = false;
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
试试这个,它会改变单个面板的可见性:
private void PanelVisible(string panelName, bool visible)
{
var panel = this.Controls.OfType<Panel>().FirstOrDefault(p => p.Name == panelName);
if (panel != default(Panel)) panel.Visible = visible;
}
Run Code Online (Sandbox Code Playgroud)
如果你想让所有的Invisible,但一个:
private void PanelVisible(string panelName)
{
foreach(var panel in this.Controls.OfType<Panel>().Where(p=>p.Name!="pnlBottom"))
{
panel.Visible = panel.Name == panelName;
}
}
Run Code Online (Sandbox Code Playgroud)