parent表单中的另一个MDIchild表单打开MDIchid

parent表单中的另一个MDIchild表单打开MDIchid

本文介绍了如何从MDIparent表单中的另一个MDIchild表单打开MDIchid表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
在这里,我有4种形式(Form1,Form2,Form3和Form4),Form1是MdiContainer(IsMdiContainer = true;),Form2,Form3和Form4是Mdichild形式.
在Form1 Load事件中,我编写了如下代码:

Hello,
Here i is have 4 forms(Form1, Form2, Form3 and Form4) Form1 is MdiContainer(IsMdiContainer = true;), Form2, Form3 and Form4 are Mdichild forms.
In Form1 Load event i wrote the code as follows:

private void Form1_Load(object sender, EventArgs e)
     {
         Form2 f2 = new Form2();
         f2.MdiParent = this;
         f2.ShowDialog();
     }


在Form2表单中,我有两个按钮,分别称为"btnf3"和"btnf4".
1.如果我单击"btnf3"
我拥有将Form3作为Form1的MDI子窗体打开的功能,并且此Form2也必须关闭. (为结束此操作,我写了this.Hide();)
2.如果我单击"btnf4",我想以Form1的MDI子窗体形式打开Form4,并且还必须关闭Form2(MDI子窗体).

请告诉我我应该在那些按钮单击事件中写些什么
在此先谢谢您.


In Form2 form i have two buttons called "btnf3"and "btnf4".
1.If i click on "btnf3"
i wnat to open Form3 as a MDI child form of Form1 and also this Form2 has to be closed. (for closing this i wrote this.Hide();)
2.If i click on "btnf4" i want to open Form4 as a MDI Child form of Form1 and also close Form2 (MDI child form) has to be closed.

Please tell me what should i write in those buttons click events
Thanks... in advance.

推荐答案



这篇关于如何从MDIparent表单中的另一个MDIchild表单打开MDIchid表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 00:42