首页 > 代码库 > C#多文档程序中如何只打开一个子窗口

C#多文档程序中如何只打开一个子窗口

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;			}		}	}}

 

C#多文档程序中如何只打开一个子窗口