using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; namespace test { /// <summary> /// Description of MainForm. /// </summary> public partial class MainForm : Form { private Form1 fm1; public MainForm() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); // // TODO: Add constructor code after the InitializeComponent() call. // } void 文件ToolStripMenuItem1Click(object sender, EventArgs e) { if(fm1==null||fm1.IsDisposed) { fm1=new Form1(); fm1.MdiParent=this; fm1.Show(); }else { fm1.Activate(); fm1.WindowState=FormWindowState.Normal; } } } }