C# Winform编程(4)多文档窗口(MDI)

多文档窗口(MDI)

添加菜单,IsMdiContainer设为True:

From窗口添加菜单

Form1.cs

csharp 复制代码
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);
        }
    }
}
相关推荐
|_⊙1 天前
C++ 智能指针
开发语言·c++
电子科技圈1 天前
IAR作为Qt Group独立BU携两项重磅汽车电子应用开发方案首秀北京车展
开发语言·人工智能·汽车·软件工程·软件构建·代码规范·设计规范
代码中介商1 天前
C语言指针深度解析:从数组指针到函数指针
c语言·开发语言
Jasmine_llq1 天前
《B4356 [GESP202506 二级] 数三角形》
开发语言·c++·双重循环枚举算法·顺序输入输出算法·去重枚举算法·整除判断算法·计数统计算法
止语Lab1 天前
Go vs Java GC:同一场延迟战争的两条路
java·开发语言·golang
Rust研习社1 天前
Rust 多线程从入门到实战
开发语言·后端·rust
Ulyanov1 天前
《玩转QT Designer Studio:从设计到实战》 QT Designer Studio数据绑定与表达式系统深度解析
开发语言·python·qt
棋子入局1 天前
C语言制作消消乐游戏(4)
c语言·开发语言·游戏
froginwe111 天前
Python3 实例
开发语言
xiaoshuaishuai81 天前
C# ZLibrary数字资源分发
开发语言·windows·c#