//删除窗体方法 private void CloseFrm() { foreach (Control item in panel1.Controls) { if (item is Form) //判断此控件是否是窗体 { Form objform = (Form)item; objform.Close(); //关闭窗体 this.panel1.Controls.Remove(item); //在pannel1中删除这个窗体 } }
//删除窗体方法 private void CloseFrm() { foreach (Control item in panel1.Controls) { if (item is Form) //判断此控件是否是窗体 { Form objform = (Form)item; objform.Close(); //关闭窗体 this.panel1.Controls.Remove(item); //在pannel1中删除这个窗体 } }