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函 ...
随机推荐
- php练习——打印半金字塔、金字塔、空心金字塔、菱形、空心菱形
半金字塔 金字塔 空心金字塔 菱形 空心菱形
- php 扩展编译linux
进入扩展库目录:$cd phpredis-master 需要root权限执行 执行:$ phpize 执行:$ ./configure 执行:$ make 执行:$ make install 编译 ...
- #Leet Code# Same Tree
语言:Python 描述:使用递归实现 # Definition for a binary tree node # class TreeNode: # def __init__(self, x): # ...
- 用Django搭建个人博客—(3)
今日主题 定义博客文章和评论的的数据库定义 定义操作这几个Model的后台数据 User表 USER_STATUS = ( ('active', u'激活'), ('suspended', u'禁用' ...
- partial函数-python学习
一个函数可以有多个参数,而在有的情况下有的参数先得到,有的参数需要在后面的情景中才能知道,python 给我们提供了partial函数用于携带部分参数生成一个新函数. def add(a,b,c=2) ...
- 2016022606 - redis事务
Redis事务 Redis事务让一组命令在单个步骤执行.事务中有两个属性,说明如下: 1.在一个事务中的所有命令按顺序执行作为单个隔离操作.通过另一个客户端发出的请求在Redis的事务的过程中执行,这 ...
- matlab操作之--读取指定文件夹下的“指定格式”文件
%% 正负样本所在folder fext='*.png';%要读取的文件格式 positiveFolder='F:\课题\Crater detection\machingLearning\Positi ...
- 百度编辑器ueditor 使用
ueditor 百度开源的一个 编辑器 ,支持api.扩展,demo丰富.推荐下 以前写 编辑 词典的使用 jquery-te 轻量级编辑器..当时看中了 它代码轻巧.容易改. 把他的功能改了好多. ...
- ios7新特性1-UI变化、UIKit动态行为支持与Text Kit新接口
iOS 7.0新特性1 iOS 7的UI经过了重新设计.另外,iOS7中引入了新的动画系统,便于创建2D和2.5D的游戏.多任务支持提升,点对点通讯以及其他重要的特征使iOS7相对于以往的SDK来说发 ...
- Windows Azure 配置SSTP
方法參考下面文章的步驟. 这个成功.http://freevpnba.com/windows-azure-sstp-vpn/ 这个没成功,不知道为什么.http://diaosbook.com/pos ...