MDI 子窗体 C#
单击“X”按钮时如何检查 MDI 子窗体的关闭事件并让父窗体知道它已关闭?
How do you check for a close event for an MDI child form when clicking the "X" button and let the parent form know that it has closed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以简单地监听 MDI 中的 FormClosed 事件。
You can simply listen to the FormClosed event in the MDI.
在表单 FormClosing 事件中,您可以执行以下操作
In the form FormClosing event you can do
从 mainForm 中将关闭事件附加到子窗体
没有检查代码,但应该不那么难
Attach a closed event to the childform from within the mainForm
didn't check the code but should not be that hard
好吧,下面的代码显示了父窗体如何识别子窗体是否已关闭,并且还可以识别是否有任何新的子窗体添加到该父窗体中。
well, The below code shows how parent form recognises whether the child form has been closed or not and it can also recognises that is there any new child form is added to that parent form..