[C#]使用MDI方法打开表单 [英] [C#] open a form using MDI method

查看:92
本文介绍了[C#]使用MDI方法打开表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我创建了三个表单,每个表单都有一个按钮。我设法通过输入以下代码使用MDI打开第二个表单:

Hello,
I created three forms and in each form there is a button. I managed to open the second form using MDI by putting this code:

Form2 Utilisateur = new Form2();
                Utilisateur.MdiParent =this;
                Utilisateur.Show();



但是现在我需要使用MDI在第二个表单上打开第三个表单,我怎么能这样做? />
谢谢。



我尝试过:



我做了第一步。单击第一个表单的按钮,它打开第二个表单,但现在我想打开第三个表单b单击第二个表单的按钮。


But now I need to open the third form being on the second form using MDI, how could I do it ?
Thank you.

What I have tried:

I did the first step. On clicking on the button of the first form it opens the second form but now I want to open the third form b clicking on the button of the second form.

推荐答案

最好的方法不是。

而是在Form2中创建一个事件,其父句处理。

你的按钮引发事件,父母处理它并创建新实例与创建Form2的方式相同。

这应该有所帮助:在两个表格之间传递信息,第2部分:儿童到父母 [ ^ ]
The best way is not to.
Instead, create an event in your Form2, which its parent handles.
Your button raises the event, the parent handles it and creates the new instance in teh same way it created Form2.
This should help: Transferring information between two forms, Part 2: Child to Parent[^]


这篇关于[C#]使用MDI方法打开表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆