Mdi的子窗口如何关闭?
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace MdiDemo
{
public class frmMain : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.ComponentModel.Container components = null;
public frmMain()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
private void InitializeComponent()
{
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.Text = "Open";
this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
//
// frmMain
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 273);
this.IsMdiContainer = true;
this.Menu = this.mainMenu1;
this.Name = "frmMain";
this.Text = "frmMain";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new frmMain());
}
private void menuItem1_Click(object sender, System.EventArgs e)
{
frmChild pForm = new frmChild();
pForm.MdiParent = this;
pForm.Show();
}
}
}