using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication3 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private static Form2 childForm; //静态变量,保存唯一实例 private void dddToolStripMenuItem_Click(object sender, EventArgs e) { Form2 childForm = GetChildForm(); //获取子窗体对象 childForm.Show(); //显示之 } private Form2 GetChildForm() { //先后次序不能错,前一个条件用来判断是否是第一次,后一个条件用来判断子窗体是否被关闭了 if (childForm == null || childForm.IsDisposed) { //第一次实例化也好,被关了也好,都重新实例化 childForm = new Form2(); childForm.MdiParent = this; } return childForm; } 转载于:https://www.cnblogs.com/zbqy/archive/2007/05/05/736137.html