首页 > 代码库 > C#窗体嵌套

C#窗体嵌套

1.思路:在一个面板上显示或者隐藏不同窗体

private void button1_Click(object sender, EventArgs e)
{
chuangti at = new chuangti();
this.panel1.Controls.Clear();
at.TopLevel = false;
at.FormBorderStyle = FormBorderStyle.None;
this.panel1.Controls.Add(at);
at.Show();
}

private void button2_Click(object sender, EventArgs e)
{
chaungB b = new chaungB();
this.panel1.Controls.Clear();
b.TopLevel = false;
b.FormBorderStyle = FormBorderStyle.None;
this.panel1.Controls.Add(b);
b.Show();
}

C#窗体嵌套