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. GitHub使用心得

    PHP今天算是学习结束了;版本控制也了解很久了,比较熟悉的是svn,Git一直都不太熟,也可能是它是英文的缘故,感觉很费劲,所以用的不多,但不得不说,它功能真的很强大;今天试着和朋友用Git开发一个简 ...

  2. 第二十八篇:SOUI中自定义控件开发过程

    在SOUI中已经提供了大部分常用的控件,但是内置控件不可能满足用户的所有要求,因此一个真实的应用少不得还要做一些自定义控件. 学习一个新东西,最简单的办法就是依葫芦画瓢.事实上在SOUI系统中内置控件 ...

  3. 特征检测之HOG

    参考: http://blog.csdn.net/liulina603/article/details/8291093 http://blog.csdn.net/woxincd/article/det ...

  4. BZOJ 3105 [CQOI2013]新Nim游戏 ——线性基

    [题目分析] 神奇的题目,两人都可以第一次取走足够多堆的石子. nim游戏的规则是,如果异或和为0,那么就先手必输,否则先手有必胜策略. 所以只需要剩下一群异或和为0就可以了. 先排序,线性基扫一遍即 ...

  5. 关于HTML5的拖拽

    不介绍具体情况,先看API,注意看后面括号的说明 dragstart:拖拽开始(应用于被拖拽对象) drag:拖拽中(应用于被拖拽对象) dragenter:拖拽到指定位置(应用于拖拽目标) drag ...

  6. 分布式缓存技术redis学习系列(一)——redis简介以及linux上的安装

    redis简介 redis是NoSQL(No Only SQL,非关系型数据库)的一种,NoSQL是以Key-Value的形式存储数据.当前主流的分布式缓存技术有redis,memcached,ssd ...

  7. ArrayList数组列表

    ArrayList数组列表 Collection接口和List接口的区别 List接口扩充了Collection接口,添加了索引相关的方法. code example Object get(int i ...

  8. 清华学堂 Range

    Descriptioin Let S be a set of n integral points on the x-axis. For each given interval [a, b], you ...

  9. Leetcode Longest Common Prefix

    Write a function to find the longest common prefix string amongst an array of strings. class Solutio ...

  10. PHP mysql基础操作

    mysql连接操作 //建立连接$con = mysql_connect('localhost', 'root', '123456');//判断是否连接成功if($con){ die('连接失败!'. ...