本文介绍了检测何时没有显示mdi子窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我可以检查MdiChildren.Length = 0,但是我应该把这个事件处理程序用于检测子窗口何时关闭? TIA Phil。 解决方案 另一个我想知道为什么? - Jan Hyde https://mvp.support.microsoft.com/profile/Jan.Hyde 子窗体应该公开一个FormClosed事件,您可以在将它们添加到mdi窗体时添加一个 事件处理程序。 br /> 我也像Jan一样好奇,你有什么理由这样做? 谢谢, Seth Rowe 另一个我想知道为什么? 我不知道为什么你需要知道原因,但是因为你问:在这个 特定的应用中,当一个或者显示更多mdi子表单, 应用程序可能被视为活动。如果没有显示任何表格, 应用程序基本上是不活动的,所以我可能会在这种情况下发生各种各样的事情。它可能就像在背景上画一些 一样简单,或者可能还有其他一些内务处理任务 可以在这个阶段完成。 我可以在每个子表单的Close事件中放入一些代码,但我可能有几个不同的表单,所以如果mdi父级可以检测到 $ b会更好当没有更多的子表单时,$ b。如果每次儿童表格关闭时父母都会被解雇,那么我可以在那时检查 剩余多少孩子。这可能吗? 谢谢 Phil。 I can check for MdiChildren.Length=0, but which event handler should I putthis in to detect when a child window is closed?TIAPhil. 解决方案Another one I''m wondering why?--Jan Hyde https://mvp.support.microsoft.com/profile/Jan.HydeThe child forms should expose a FormClosed event that you could add anevent handler to when you add them to your mdi form.I also am curious like Jan, what reason do you have for doing this?Thanks,Seth RoweAnother one I''m wondering why?I''m not sure why you need to know why, but since you asked: In thisparticular application, when one or more mdi child forms are displayed, theapplication might be considered ''active''. If there are no forms displayed,the application is basically inactive, so there are various things I mightwant to happen in this situation. It might be as simple as doing somedrawing on the background, or there might be some other housekeeping tasksthat can be done at this stage.I could put some code in the Close event for each child form, but I may haveseveral different forms, so it would be nicer if the mdi parent could detectwhen there are no more child forms left. If there is an event that is firedin the parent each time a child form is closed, I can check at that pointhow many children are remaining. Is this possible?ThanksPhil. 这篇关于检测何时没有显示mdi子窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-20 08:42