首页 > Windows开发 > 详细

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

时间:2016-11-27 10:01:02      阅读:333      评论:0      收藏:0      [点我收藏+]
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#多文档程序中如何只打开一个子窗口

原文:http://www.cnblogs.com/China3S/p/6105927.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!