SDI窗体:single 单独的
MDI(multiple-doucument interface,多文档界面)用于同时显示多个文档,MDI窗体的创建避免了用户打开很多窗口的时候任务程中挤满了窗体
MDI窗体使用方法
确定一个主窗体,把窗体的IsMdicontainer属性设置为true.
创建子窗体,并且设置他们为副窗体
例子:
private void 新建CToolStripMenuItem_Click(object sender, EventArgs e)
{
//实例化子窗体
FMDI myfmdi = new FMDI();
//子窗体.副窗体=this(这里的this指的就是winfromMdi)
myfmdi.MdiParent = this;
//显示子窗体
myfmdi.Show();
}
private void 层叠bToolStripMenuItem_Click(object sender, EventArgs e)
{
//这句话的意思就是layout是布局函数,layoutmdi布局MDI。(MdiLayout.arrangeIcons)意思就是MDI布局.按照图标排列 arrange 排列 icons 图标
LayoutMdi(MdiLayout.ArrangeIcons);
}
private void 水平ToolStripMenuItem_Click(object sender, EventArgs e)
{
//水平排列
LayoutMdi(MdiLayout.TileHorizontal);
}
private void 垂直ToolStripMenuItem_Click(object sender, EventArgs e)
{
LayoutMdi(MdiLayout.TileVertical);
}
private void 关闭ToolStripMenuItem_Click(object sender, EventArgs e)
{
//点击这里 winfromMdi窗体关闭
this.Close();
}
private void 新建CToolStripMenuItem_Click(object sender, EventArgs e) { //实例化子窗体 FMDI myfmdi = new FMDI(); //子窗体.副窗体=this(这里的this指的就是winfromMdi) myfmdi.MdiParent = this; //显示子窗体 myfmdi.Show(); } private void 层叠bToolStripMenuItem_Click(object sender, EventArgs e) { //这句话的意思就是layout是布局函数,layoutmdi布局MDI。(MdiLayout.arrangeIcons)意思就是MDI布局.按照图标排列 arrange 排列 icons 图标 LayoutMdi(MdiLayout.ArrangeIcons); } private void 水平ToolStripMenuItem_Click(object sender, EventArgs e) { //水平排列 LayoutMdi(MdiLayout.TileHorizontal); } private void 垂直ToolStripMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.TileVertical); } private void 关闭ToolStripMenuItem_Click(object sender, EventArgs e) { //点击这里 winfromMdi窗体关闭 this.Close(); }