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();
}

posted @ 2014-12-04 21:38  fx427103  阅读(566)  评论(0编辑  收藏  举报