1.private Form m_CurrentMdiChild;//声明窗体
2.打开你想要的窗口
private void ShowForm()
{
Form1 frm = new Form1();
frm.ShowMdiChild(frm);
}
3.private void ShowMdiChild(Form mdiForm)
{
if (this.m_CurrentMdiChild != null)
{
this.m_CurrentMdiChild.Close(); //关闭当前窗体
}
this.m_CurrentMdiChild = mdiForm; //本窗体设置成为当前窗体
mdiForm.MdiParent = this;
mdiForm.WindowState = FormWindowState.Maximized;
mdiForm.Show();
}