using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication7
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{ private int Count=0;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.MenuItem New;
private System.Windows.Forms.MenuItem Active;
private System.Windows.Forms.MenuItem Exit;
private System.Windows.Forms.MenuItem Cascade;
private System.Windows.Forms.MenuItem Horizontal;
private System.Windows.Forms.MenuItem Vertical;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.New = new System.Windows.Forms.MenuItem();
this.Active = new System.Windows.Forms.MenuItem();
this.Exit = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.Cascade = new System.Windows.Forms.MenuItem();
this.Horizontal = new System.Windows.Forms.MenuItem();
this.Vertical = new System.Windows.Forms.MenuItem();
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem5});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.New,
this.Active,
this.Exit});
this.menuItem1.Text = "File";
//
// New
//
this.New.Index = 0;
this.New.Text = "New";
this.New.Click += new System.EventHandler(this.New_Click);
//
// Active
//
this.Active.Index = 1;
this.Active.Shortcut = System.Windows.Forms.Shortcut.AltF9;
this.Active.Text = "Active Child";
this.Active.Visible = false;
this.Active.Click += new System.EventHandler(this.Active_Click);
//
// Exit
//
this.Exit.Index = 2;
this.Exit.Text = "Exit";
this.Exit.Click += new System.EventHandler(this.Exit_Click);
//
// menuItem5
//
this.menuItem5.Index = 1;
this.menuItem5.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.Cascade,
this.Horizontal,
this.Vertical});
this.menuItem5.Text = "Arrange";
//
// Cascade
//
this.Cascade.Index = 0;
this.Cascade.Text = "Cascade";
this.Cascade.Click += new System.EventHandler(this.Cascade_Click);
//
// Horizontal
//
this.Horizontal.Index = 1;
this.Horizontal.Text = "Horizontal";
this.Horizontal.Click += new System.EventHandler(this.Horizontal_Click);
//
// Vertical
//
this.Vertical.Index = 2;
this.Vertical.Text = "Vertical";
this.Vertical.Click += new System.EventHandler(this.Vertical_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Exit_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void Active_Click(object sender, System.EventArgs e)
{
MessageBox.Show(this.ActiveMdiChild.Text,"Mdi FORM");
}
private void New_Click(object sender, System.EventArgs e)
{
Form frmchild = new Form();
frmchild.MdiParent=this;
frmchild.Show();
frmchild.Text="Child Form"+ Count.ToString();
Count++;
}
private void Horizontal_Click(object sender, System.EventArgs e)
{
this.LayoutMdi(MdiLayout.TileHorizontal);
}
private void Vertical_Click(object sender, System.EventArgs e)
{
this.LayoutMdi(MdiLayout.TileVertical);
}
private void Cascade_Click(object sender, System.EventArgs e)
{
this.LayoutMdi(MdiLayout.Cascade);
}
private void Form1_Load(object sender, System.EventArgs e)
{
}
}
}
怎么老是说未添加异常什么的??????
帮忙看看,感激不尽!
[此贴子已经被作者于2006-4-19 15:42:47编辑过]