日期:2014-05-18  浏览次数:20932 次

怎样关闭panel 里的mdi 窗体
C# code
  foreach (Form frm in this.MdiChildren)
            {
                frm.Close();
           

}

这样可以关闭mdi窗体,但我的窗体是放在panel里,请问怎么关闭

------解决方案--------------------
Form2 form = new Form2();
private void button1_Click(object sender, EventArgs e)
{
form.TopLevel = false;
form.Dock = DockStyle.Fill;
form.FormBorderStyle = FormBorderStyle.None;
form.Parent = panel1;
form.Show();
}private void button2_Click(object sender, EventArgs e)
{
panel1.Controls.Remove(form);
}