多文档窗口(MDI)
添加菜单,IsMdiContainer设为True:
From窗口添加菜单
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace 多文档界面MDI
{public partial class Form1 : Form{public Form1(){InitializeComponent();}private void Form1_Load(object sender, EventArgs e){}private void 视频ToolStripMenuItem_Click(object sender, EventArgs e){}private void 编辑ToolStripMenuItem_Click(object sender, EventArgs e){}private void 窗口ToolStripMenuItem_Click(object sender, EventArgs e){//MessageBox.Show("窗口被单击", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);}private void 子窗口2ToolStripMenuItem_Click(object sender, EventArgs e){Form2 Mdichild = new Form2();Mdichild.MdiParent = this;Mdichild.Show();}private void 子窗口3ToolStripMenuItem_Click(object sender, EventArgs e){}private void 窗口层叠ToolStripMenuItem_Click(object sender, EventArgs e){this.LayoutMdi(MdiLayout.Cascade);}private void 水平平铺ToolStripMenuItem_Click(object sender, EventArgs e){this.LayoutMdi(MdiLayout.TileHorizontal);}private void 垂直平铺ToolStripMenuItem_Click(object sender, EventArgs e){this.LayoutMdi(MdiLayout.TileVertical);}}
}