我尝试在 UserControl 上的 tabControls 上切换面板。像这样
private void button1_Click(object sender, EventArgs e)
{
panel1.Visible=true;
panel2.Visible=false;
.....
panelN.Visible=false;
}
private void button2_Click(object sender, EventArgs e)
{
panel1.Visible=false;
panel2.Visible=true;
.....
panelN.Visible=false;
}
private void buttonN_Click(object sender, EventArgs e)
{
panel1.Visible=false;
panel2.Visible=false;
.....
panelN.Visible=true;
}
但当 N 超过 6 时,切换面板效果不佳。
即使发生 Button 事件,某些面板也不可见!
那么你能告诉我如何切换多面板吗?
如果可能的话,你能告诉我切换面板的聪明方法吗?
上面的代码似乎可读性不好。