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);
        }
    }
}
相关推荐
geovindu2 分钟前
rust: Functional Options Pattern
开发语言·后端·设计模式·rust·函数式选项模式·惯用法型模式
skywalk81631 小时前
把「假成功」赶出工具层:lightharness 两天升级复盘(4×5 模式矩阵 + 工具层 5 个缺陷)
开发语言·前端·人工智能·lightharness
敲上瘾1 小时前
Qt控件通用属性:geometry、qrc资源到QSS样式表等
开发语言·c++·qt·ui
听情歌落俗2 小时前
嵌入式学习1-C语言基础语法与STM32实践
c语言·开发语言
小飞在努力3 小时前
【实现负载均匀在线判题⑤】MVC 架构搭建与 Model 题目数据模块实现
c语言·开发语言·c++·笔记·后端
落羽的落羽4 小时前
【C++】现代容器: tuple、optional、variant、any、string_view
linux·开发语言·数据结构·c++·人工智能·计算机网络·算法
小飞在努力6 小时前
【实现负载均匀在线判题④】接入 cpp-httplib 实现编译服务 HTTP 网络化
c语言·开发语言·c++·笔记·http
炸薯条!6 小时前
Python面向对象基础:类与对象、实例方法、魔法方法和属性详解
java·开发语言·python
Risehuxyc6 小时前
HttpClient怎么传POST参数
c#
CappuccinoRose6 小时前
前端开发交互体系 - 汇总篇
开发语言·前端·javascript·css·html·交互