C#-Mdi多文档窗体及其子窗体的排列 ---ShinePans
MdiLayout枚举成员及说明 |
Casecade | s全部Mdi层叠在父窗体 |
TileHorizontal | 水平平铺 |
TitleVertical | 垂直平铺 |
Form1.cs (mdi) |
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 Test1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void 载入子窗口ToolStripMenuItem_Click(object sender, EventArgs e) { Form2 frm2 = new Form2(); //实例化 Form2 frm2.MdiParent = this; //设置MdiParent属性,将当前窗口作为父窗 frm2.Show(); //使用show方法打开窗口 Form3 frm3 = new Form3(); frm3.MdiParent = this; frm3.Show(); Form4 frm4 = new Form4(); frm4.MdiParent = this; frm4.Show(); } 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) { LayoutMdi(MdiLayout.Cascade); } }}
Form1.Designer namespace Test1 { partial class Form1 { /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// 清理全部正在使用的资源。 /// </summary> /// <param name="disposing">假设应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows 窗口设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器改动此方法的内容。 /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.载入子窗口ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.水平平铺ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.垂直平铺ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.层叠排列ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 // this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.载入子窗口ToolStripMenuItem, this.水平平铺ToolStripMenuItem, this.垂直平铺ToolStripMenuItem, this.层叠排列ToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(648, 25); this.menuStrip1.TabIndex = 1; this.menuStrip1.Text = "menuStrip1"; // // contextMenuStrip1 // this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4); // // 载入子窗口ToolStripMenuItem // this.载入子窗口ToolStripMenuItem.Name = "载入子窗口ToolStripMenuItem"; this.载入子窗口ToolStripMenuItem.Size = new System.Drawing.Size(80, 21); this.载入子窗口ToolStripMenuItem.Text = "载入子窗口"; this.载入子窗口ToolStripMenuItem.Click += new System.EventHandler(this.载入子窗口ToolStripMenuItem_Click); // // 水平平铺ToolStripMenuItem // this.水平平铺ToolStripMenuItem.Name = "水平平铺ToolStripMenuItem"; this.水平平铺ToolStripMenuItem.Size = new System.Drawing.Size(68, 21); this.水平平铺ToolStripMenuItem.Text = "水平平铺"; this.水平平铺ToolStripMenuItem.Click += new System.EventHandler(this.水平平铺ToolStripMenuItem_Click); // // 垂直平铺ToolStripMenuItem // this.垂直平铺ToolStripMenuItem.Name = "垂直平铺ToolStripMenuItem"; this.垂直平铺ToolStripMenuItem.Size = new System.Drawing.Size(68, 21); this.垂直平铺ToolStripMenuItem.Text = "垂直平铺"; this.垂直平铺ToolStripMenuItem.Click += new System.EventHandler(this.垂直平铺ToolStripMenuItem_Click); // // 层叠排列ToolStripMenuItem // this.层叠排列ToolStripMenuItem.Name = "层叠排列ToolStripMenuItem"; this.层叠排列ToolStripMenuItem.Size = new System.Drawing.Size(68, 21); this.层叠排列ToolStripMenuItem.Text = "层叠排列"; this.层叠排列ToolStripMenuItem.Click += new System.EventHandler(this.层叠排列ToolStripMenuItem_Click); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.Window; this.ClientSize = new System.Drawing.Size(648, 309); this.Controls.Add(this.menuStrip1); this.IsMdiContainer = true; this.MainMenuStrip = this.menuStrip1; this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.ToolStripMenuItem 载入子窗口ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 水平平铺ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 垂直平铺ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 层叠排列ToolStripMenuItem; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; }}
Form2.cs Form3.Cs Form4.cs 为默认值
C#-Mdi多文档窗体及其子窗体的排列 ---ShinePans的更多相关文章
- delphi 判断MDI窗体的子窗体是否存在
//***************************************************************************//函 数名: CreateForm //返 ...
- 判断MDI窗体的子窗体是否存在
//***************************************************************************//函 数名: CreateForm//返 回 ...
- delphi判断MDI窗体的子窗体是否存在
转]delphi判断MDI窗体的子窗体是否存在//*************************************************************************** ...
- 附实例!实现iframe父窗体与子窗体的通信
欢迎大家前往腾讯云+社区,获取更多腾讯海量技术实践干货哦~ 本文由前端林子发表于云+社区专栏 本文主要会介绍如何基于MessengerJS,实现iframe父窗体与子窗体间的通信,传递数据信息.同时本 ...
- C#之菜单控件、主窗体打开子窗体、GroupBox控件使用
一.背景 一年前有学习过C#,但没有在项目中去实际做APP,重新捡起来应用到项目中.我同事本来做好一个CANOPEN设备管理的界面,由于近期搜索了别人的开发的界面,我觉得有很多东西要重新安排,以及我已 ...
- winform里操作打开在panel里的form窗体,子窗体操作同级子窗体或者父窗体的方法
最近开始了一个winform项目,原先一直都是web项目.遇到个问题,就是在框架内,左侧和中间的main都是用panel来实现的form,就是把form窗体打开到panel里,实现左侧是导航,中间是操 ...
- Caliburn.Micro 关闭父窗体打开子窗体
比如我们在做登录的时候需要关闭父窗体打开子窗体.使用Caliburn.Micro它的时候我们关闭登录窗口的时候主页面也会关闭. 解决方法就是在登录页面的CS里面写 IndexView iv = new ...
- C# 关闭子窗体释放子窗体对象问题
1 在主窗口中实例化子窗口 Form2 f2 = new Form2(); 2 通过按钮来显示子窗口 f2.Show(); 3 关闭子窗口而不释放子窗口对象的方法 protected override ...
- C#_父窗体跟子窗体的控件操作
很多人都苦恼于如何在子窗体中操作主窗体上的控件,或者在主窗体中操作子窗体上的控件.相比较而言,后面稍微简单一些,只要在主窗体中创建子窗体的时候,保留所创建子窗体对象即可. 下面重点介绍前一种,目前常见 ...
- 界面主窗体,子窗体的InitializeComponent(构造函数)、Load事件执行顺序
主窗体,子窗体的InitializeComponent(构造函数).Load事件执行顺序1.执行主窗体定义事件 new函数时,同时执行主窗体构造函数,默认就一个InitializeComponent函 ...
随机推荐
- ES6-个人学习笔记一--let和const
es6已经推出一段时间了,虽然在兼容和应用上还有不少的难题,但是其提供的未来前端代码编程的发展趋势和一些好用的功能还是很吸引人的,因此个人买了'阮一峰'先生的es6入门,希望对其有一个了解和学习,本系 ...
- 使用Markdown在博客里插入代码
今天尝试了一下在线使用Markdown编辑器写博客,发现想要实现下面这样的效果还真得折腾一会儿. <html> <head> <meta charset="ut ...
- java rest接口返回不完整的json数据
ngix配置有问题,数据量大时把部分数据给拦截了. {"userId":237,"loginName":"mingshi","us ...
- 【Maven】解决maven打jar包报错 source 1.3 中不支持注释 (请使用 -sour
问题:maven在进行打包时,报 '请使用-source 5 或者更高版本以启用XX'的信息并导致打包失败. 原因:maven默认的编译插件的java版本较低,导致其不支持例如泛型,注解等用法. 解决 ...
- [spring-framework]Spring定时器的配置和使用
开发中我们常常会做一些定时任务,这些任务有开始时间,并会按一定的周期或规则执行.如此我们在Java程序开发中使用定时器来处理定时任务. <!-- MessageRequestTask类中包含了m ...
- VARCHAR2字段关联
SQL> create table a1(id int,name varchar2(10)); Table created. SQL> create table a2(id int,nam ...
- bzoj3143
之前我们曾经用dp解决过数学期望问题,这次我们用的是解方程的方法首先在编号之前,肯定要求出每条边的期望经过次数然后可以转化为求边端点的期望次数这种做法我一开始接触是noip2013的初赛问题求解,是类 ...
- DOS - COPY
copy,中文含义为"复制",一个很容易见名知意的命令,它的作用是复制文件,用法十分简单:copy 源文件 目的路径. 假设,你需要把d:\test\test.txt这个文件复 ...
- Drools引擎学习
首先上一段话: 为提高效率,管理流程必须自动化,即使现代商业规则异常复杂.市场要求业务规则经常变化,系统必须依据业务规则的变化快速.低成本的更新.为了快速.低成本的更新,业务人员应能直接管系统中的规则 ...
- Google Map API 学习五
今天其实收货很大的 1.InfoWindow google.maps.InfoWindow class An overlay that looks like a bubble and is often ...