如何在子窗体2关闭时以mdi父窗体显示消息框 [英] How to showing message box in mdi parent form when child form2 is closed

查看:91
本文介绍了如何在子窗体2关闭时以mdi父窗体显示消息框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很想设置mdichild激活事件,但它的工作形式是所有的儿童形式,但我只看到一个子形式form2。我有3个孩子的形式。 form1,Form2和form3。

请帮帮我怎样才能解决它..



我尝试了什么:



private void MDI PATENT_MdiChildActivate(对象发件人,EventArgs e)

{



if(this.mdichildren.lenght == null)

{

messagebox.show(表格2已关闭);

}

}

i was trie to set in mdichild activate event but its work form all child form but i wat its for only one child form form2. i have 3 child form. form1,Form2 and form3.
please help me how can i solve it..

What I have tried:

private void MDI PATENT_MdiChildActivate(object sender, EventArgs e)
{

if(this.mdichildren.lenght==null)
{
messagebox.show("Form 2 is Closed");
}
}

推荐答案

而不是依赖于激活方法为另一个孩子 - 如果只有一个孩子可能不会发生MDI子项打开 - 处理FormClosing或FormClosed事件,并在其中显示您的消息框。
Instead of relying on the Activate method for a different child - which may not happen if there is only one MDI child open - handle the FormClosing or FormClosed event instead and display your message box in that.


这篇关于如何在子窗体2关闭时以mdi父窗体显示消息框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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