using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace MDIApplication1
{
public partial class MDI : Form
{
private MainMenu mainMenu;
private int Count = 0;
public MDI()
{
InitializeComponent();
this .IsMdiContainer =true ;
this .Text ="MDI Demo";
mainMenu =new MainMenu ();
MenuItem File=mainMenu .MenuItems.Add("&File");
File .MenuItems .Add (new MenuItem ("&New",new EventHandler (this .FileNew_Click),Shortcut .CtrlN));
File .MenuItems .Add (new MenuItem ("&Active_Child",new EventHandler (this .FindActive_Click),Shortcut .CtrlA ));
File .MenuItems .Add (new MenuItem ("-"));
File.MenuItems.Add(new MenuItem("&Exit", new EventHandler(this.FileExit_Click), Shortcut.CtrlX));
MenuItem Arrange=mainMenu .MenuItems.Add("&Arrange");
Arrange.MenuItems.Add(new MenuItem("&Cascade", new EventHandler(this.Cascade_Click), Shortcut.F1));
Arrange.MenuItems.Add(new MenuItem("&Horizontal", new EventHandler(this.Horizontal_Click), Shortcut.F2));
Arrange.MenuItems.Add(new MenuItem("&Vertical", new EventHandler(this.Vertical_Click), Shortcut.F3));
this .Menu=mainMenu ;
mainMenu .GetForm().BackColor=Color .Indigo ;
}
private void MDI_Load(object sender, EventArgs e)
{ } private void FileExit_Click(object sender, EventArgs e)
{
this.Close; ( ← 错误只有 assignment、call、increment、decrement 和 new 对象表达式可用作语句 D:\Test\MDIApplication1\MDIApplication1\MDI.cs)
} private void FindActive_Click(object sender, EventArgs e)
{
MessageBox.Show(this.ActiveMdiChild .Text, "Mdi Form");
} private void FileNew_Click(object sender, EventArgs e)
{
Form frmchild = new Form();
frmchild.MdiParent = this;
frmchild.Show();
frmchild.Text = "Child Form" + Count.ToString();
Count++;
} private void Cascade_Click(object sender, EventArgs e)
{
this.LayoutMdi(MdiLayout.Cascade);
} private void Horizontal_Click(object sender, EventArgs e)
{
this.LayoutMdi(MdiLayout.TileHorizontal);
} private void Vertical_Click(object sender, EventArgs e)
{
this.LayoutMdi(MdiLayout.TileVertical);
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace MDIApplication1
{
public partial class MDI : Form
{
private MainMenu mainMenu;
private int Count = 0;
public MDI()
{
InitializeComponent();
this .IsMdiContainer =true ;
this .Text ="MDI Demo";
mainMenu =new MainMenu ();
MenuItem File=mainMenu .MenuItems.Add("&File");
File .MenuItems .Add (new MenuItem ("&New",new EventHandler (this .FileNew_Click),Shortcut .CtrlN));
File .MenuItems .Add (new MenuItem ("&Active_Child",new EventHandler (this .FindActive_Click),Shortcut .CtrlA ));
File .MenuItems .Add (new MenuItem ("-"));
File.MenuItems.Add(new MenuItem("&Exit", new EventHandler(this.FileExit_Click), Shortcut.CtrlX));
MenuItem Arrange=mainMenu .MenuItems.Add("&Arrange");
Arrange.MenuItems.Add(new MenuItem("&Cascade", new EventHandler(this.Cascade_Click), Shortcut.F1));
Arrange.MenuItems.Add(new MenuItem("&Horizontal", new EventHandler(this.Horizontal_Click), Shortcut.F2));
Arrange.MenuItems.Add(new MenuItem("&Vertical", new EventHandler(this.Vertical_Click), Shortcut.F3));
this .Menu=mainMenu ;
mainMenu .GetForm().BackColor=Color .Indigo ;
}
private void MDI_Load(object sender, EventArgs e)
{ } private void FileExit_Click(object sender, EventArgs e)
{
this.Close; ( ← 错误只有 assignment、call、increment、decrement 和 new 对象表达式可用作语句 D:\Test\MDIApplication1\MDIApplication1\MDI.cs)
} private void FindActive_Click(object sender, EventArgs e)
{
MessageBox.Show(this.ActiveMdiChild .Text, "Mdi Form");
} private void FileNew_Click(object sender, EventArgs e)
{
Form frmchild = new Form();
frmchild.MdiParent = this;
frmchild.Show();
frmchild.Text = "Child Form" + Count.ToString();
Count++;
} private void Cascade_Click(object sender, EventArgs e)
{
this.LayoutMdi(MdiLayout.Cascade);
} private void Horizontal_Click(object sender, EventArgs e)
{
this.LayoutMdi(MdiLayout.TileHorizontal);
} private void Vertical_Click(object sender, EventArgs e)
{
this.LayoutMdi(MdiLayout.TileVertical);
}
}
}
解决方案 »
- c#如何根据这个要球写这个webservice呢?
- 自定义的DataTable不能作为ReportViewer的BingdingSource数据源吗?
- 可不可以建一个winform,像messagebox一样的?
- 解析这段字符 在线等 很简单
- 咋个在C#中制作圆形的按钮(菜鸟提问,希望各位大大回答详细点哦!。。谢谢!)
- 如何锁定计算机,屏蔽系统(windows)功能键?winfrom实现?
- 如何获取在网页浏览时鼠标移动到的超链接的该超链接的URL
- datagrid显示图片问题
- 高手请进,可惜我没分了~~帮我的我会记住,下次一定给分!~
- 关于C#中的界面设计的问提!再线等待~~~~!!!
- 修改配置文件出错
- 用C#的Net.Mail发的电子邮件,到接收人邮件里总是发现个别字或连续几个字出现乱码,是怎么回事
{
this.Close(); ( ← 错误只有 assignment、call、increment、decrement 和 new 对象表达式可用作语句 D:\Test\MDIApplication1\MDIApplication1\MDI.cs)
}
close()是方法不是属性,后面要加括号。
细节决定一切,请楼主共勉。
close()是方法不是属性,后面要加括号。
细节决定一切,请楼主共勉。