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函 ...
随机推荐
- Rendering Transparent 3D Surfaces in WPF with C#(转载)
Rendering Transparent 3D Surfaces in WPF with C# The primary problems that arise when rendering semi ...
- 桂电在线-php-提取菜单到配置文件2
继续昨晚没完成的主菜单模板: <!-- 菜单块 --> <div class="on-light" id="menus"> <?p ...
- mysql远程连接
多人开发时,每人一份程序文件.但是有时需要公用一个份数据库.这时就需要数据库能远程连接. 现在以mysql为例演示一下. 这里远程连接可以 1.允许固定客户端ip登陆. select host,use ...
- JSP中使用的模式——JSP+Servlet+JavaBean
上一篇博文写到模式一:JSP+JavaBean 链接地址:http://wxmimperio.coding.io/?p=155 JSP中两种模式的总结 链接地址:http://wxmimperio.c ...
- netsat -ano 查看已占用的端口以及tomcat出现端口被占或者启动失败问题
A.在DOS命令下:输入netstat -ano——回车,可以查看已占用的端口,记下端口的PID,然后打开任务管理器,点查看,选择列,勾选PID确定,找到对应的PID,结束进程,如果结束不了或者结束后 ...
- SQL Server ->> 深入探讨SQL Server 2016新特性之 --- Temporal Table(历史表)
原文:SQL Server ->> 深入探讨SQL Server 2016新特性之 --- Temporal Table(历史表) 作为SQL Server 2016(CTP3.x)的另一 ...
- Hibernate中对象的三种状态以及Session类中saveOrUpdate方法与merge方法的区别
首先,用一张图说明一个对象,在Hibernate中,在调用了不同方法之后对象所处的不同状态 在Hibernate中,一个对象的状态可以被分为如图所示的三种 Transient:瞬时对象,该对象在数据库 ...
- 集成activiti-modeler 到 自己的业务系统
本文目的: 将activit 5.12.1 的 modeler 流程设计器 集成到自己的工程中去 解决问题: 1. 复制相关资源文件到自己的工程中 2. 解决modeler的路径访问问题,迁移到非系统 ...
- c3p0数据库连接池的使用
一.c3p0与dbcp区别 dbcp没有自动回收空闲连接的功能 c3p0有自动回收空闲连接功能 <C3P0是Hibernate3.0默认的自带数据库连接池,DBCP是Apache开发的数据库连接 ...
- web版本控制
说说你在web开发中是怎么进行版本管理的 在web开发中,我首先将系统框架搭建完成后,我会发布到服务器上,然后给小组成员进行分工,为他们划分各自的模块,他们每天早上上班时就从服务器上先将自己机器上面的 ...