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 WindowsFormsApplication1
 {
     public partial class Form1 : Form
     {
         private string name;
         public Form1()
         {
             InitializeComponent();
         }

         private void button1_Click(object sender, EventArgs e)
         {
             Form2 frm2 = new Form2();
             frm2.MdiParent = this;
             frm2.Show();
         }

         private void button2_Click(object sender, EventArgs e)
         {
             Form3 frm1 = new Form3();
             frm1.MdiParent = this;
             frm1.Show();
         }
         public event Action<string> OnText;
         public void ToChangeText(string obj)
         {
             if (OnText != null)
             {
                 OnText(obj);}
         }
         private void Form1_Load(object sender, EventArgs e)
         {

         }
     }
 }
 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 WindowsFormsApplication1
 {
     public partial class Form2 : Form
     {
         public Form2()
         {
             InitializeComponent();
         }

         private void button1_Click(object sender, EventArgs e)
         {
             (this.ParentForm as Form1).ToChangeText("form2来的消息啊?");
         }
     }
 }
 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 WindowsFormsApplication1
 {
     public partial class Form3 : Form
     {
         public Form3()
         {
             InitializeComponent();
         }

         private void Form3_Load(object sender, EventArgs e)
         {
             MessageBox.Show(this.ParentForm.Name);
             (this.ParentForm as Form1).OnText += new Action<string>(Form3_OnText);
         }
         private void Form3_FormClosed(object sender, FormClosedEventArgs e)
         {
             (this.ParentForm as Form1).OnText -= new Action<string>(Form3_OnText);
         }
         void Form3_OnText(string obj)
         {
             textBox1.Text = textBox1.Text+obj;
         }
     }
 }

C# MDI子窗体互相操作的更多相关文章

  1. 用DLL方式封装MDI子窗体

    用DLL方式封装MDI子窗体是一种常用的软件研发技术,他的长处: 研发人员能够负责某一个模块的编写包括(界面+逻辑),能够互不干扰,模块研发完成后,主程式统一调用. 易于程式升级,当程式升级时,不用编 ...

  2. 解决WinForm(C#)中MDI子窗体最大化的问题

    “用MDI方式打开一个子窗口体后,总是不能最大化显示,明明子窗口体的WindowState设置为Maximized?”,相信有很多人会遇到这的样问题,请按下面的方法设置即可使MDI子窗体最大化: 1. ...

  3. Delphi中实现MDI子窗体(转)

        Delphi中实现MDI子窗体 用MDI实现浏览子窗口,具有窗口管理功能,同屏观看多个网页的内容  ① 多文档窗体(MDI) MDI窗体是一种具有主子结构的窗体体系,微软的Word便是其中的一 ...

  4. 保证相同类型的MDI子窗体只会被打开一次的方法

    本文转载:http://www.cnblogs.com/Ricky81317/archive/2008/09/17/1292443.html 看到论坛中有朋友问,如何可以保证在MDI主窗体中,同一类型 ...

  5. 在DLL动态链接库中封装VCL的MDI子窗体

    在DLL动态链接库中封装VCL的MDI子窗体不多说了,看代码就应该明白了,曾经我遇到的问题,现在放出来大家共享! 这里是工程文件的部分: 在DLL中封装MDI子窗体需要重写DLL入口函数,具体代码如下 ...

  6. Delphi MDI 子窗体的创建和销毁 [zhuan]

    1.如果要创建一个mdi child,先看是否有这个child 存在,如果有,则用它,如果没有再创建 //该函数判断MDI 子窗体是否存在,再进行创建和显示function isInclude(for ...

  7. 解决WinForm(C#)中MDI子窗体最大化跑偏的问题

    “用MDI方式打开一个子窗口体后,总是不能最大化显示,明明子窗口体的WindowState设置为Maximized?”,相信有很多人会遇到这的样问题,请按下面的方法设置即可使MDI子窗体最大化: 1. ...

  8. C# 设置MDI子窗体只能弹出一个的方法

    Windows程序设计中的MDI(Multiple Document Interface)官方解释就是所谓的多文档界面,与此对应就有单文档界面 (SDI), 它是微软公司从Windows .0下的Mi ...

  9. Ribbon 窗体的 MDI 子窗体使用 TabbedMDIManager 切换时工具条闪屏问题的解决办法

    补充说明: 此问题已经在新版本中解决(15.2.6),方法更加简单,只需要在 MDIChild 窗体的 Create 方法中,将 Ribbon 的 Visible 属性设置为 false 就可以了,且 ...

随机推荐

  1. .NET中RabbitMQ的使用

    概述 MQ全称为Message Queue, 消息队列(MQ)是一种应用程序对应用程序的通信方法.RabbitMQ是一个在AMQP基础上完整的,可复用的企业消息系统.他遵循Mozilla Public ...

  2. LeetCode——Best Time to Buy and Sell Stock II (股票买卖时机问题2)

    问题: Say you have an array for which the ith element is the price of a given stock on day i. Design a ...

  3. IOC装配Bean(XML方式)

    Spring框架Bean实例化的方式 提供了三种方式实例化Bean 构造方法实例化(默认无参数,用的最多) 静态工厂实例化 实例工厂实例化 无参数构造方法的实例化 <!-- 默认情况下使用的就是 ...

  4. nodejs review-01

    lesson lesson-code 05 Run your first web server 使用curl //指定方法;显示header信息 curl -X GET -i localhost:30 ...

  5. 数学 SRM 690 Div1 WolfCardGame 300

    Problem Statement      Wolf Sothe and Cat Snuke are playing a card game. The game is played with exa ...

  6. Ext3文件系统及JDB介绍

    Ext3介绍 对于ext3文件系统,磁盘空间划分一系列block groups,每个group有位图来跟踪inode和data块的分配和范围.其物理布局如下: Superblock:位于group内第 ...

  7. Django分析之Middleware中间件

    写了几周的脚本,今天终于开始接触web框架了~学习Python的web框架,那么Django就几乎是必修课了,这次的工作是先打打下手,主要的任务是在setting中添加版本号,在渲染静态css,js的 ...

  8. Tornado学习笔记12 tornado.httpserver-.非阻塞的Http服务器

    是一个非阻塞的,单线程的Http 服务器. 一般地,应用程序很少与HttpServer类直接交互,除非在进程开始时启动服务时(甚至在使用tornado.web.Applicaiton.listen时也 ...

  9. JAVA学习笔记之static——2016.3.10

    static关键字   作用:修饰符,用于修饰成员<成员产量,成员方法>     1'被修饰的成员产量只有一份.     2'被修饰后的成员多了一种方式的访问,除了可以对象调用外,还可以被 ...

  10. 如何在VS2012中使用IL Disassembler中查看项目编译生成的程序集

    2016-05-26 11:48:46 测试的WPF项目 MainWindow.xaml代码 MainWindow.xaml.cs 代码 在学习WPF的时候,想验证:删除MainWindow.xaml ...