如何在mdiparent中检查是否有任何表单是打开的 [英] How to check whether anyone form is open or not in mdiparent

查看:92
本文介绍了如何在mdiparent中检查是否有任何表单是打开的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨frds,

例如

我的mdiparent包含两个子表单。 Form1已经打开,此时我点击Form2意味着它没有打开。它将显示消息框。我怎么能这样做?

解决方案

查看 Form.MdiChildren [ ^ ]集合并查找Form1的实例。如果它在那里,使用MessageBox.Show来显示你的消息,而不是打开Form2。


听取一个很好的友好建议:永远不要使用MDI。你为什么要折磨自己并吓跑你的用户?它不仅看起来过时了,而且使用它真的很尴尬。即便是微软付出了相当大的努力来逐步淘汰它,也不鼓励开发者使用它。请参阅:

http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages

如何在WPF中创建MDI父窗口?



我可以解释做什么。请看我过去的答案:

如何在WPF中创建MDI父窗口?

关于在WPF中使用MDI窗口的问题

MDIContainer给出错误

如何设置最大化的子表单,最小化最后一个子表单



-SA

Hi frds,
For Example
my mdiparent contain two child forms. Already Form1 is open, at this time I click Form2 means it doesn't open. It will show the message box. How Can I do this?

解决方案

Look through the Form.MdiChildren[^] collection and look for an instance of Form1. If it's there, use MessageBox.Show to display your message instead of opening Form2.


Listen to a good friendly advice: never ever use MDI. Why would you want to torture yourself and scare off your user. Not only it looks outdated, but it really utterly awkward to use. Even Microsoft paid decent effort to phase it out and discourage developers to use it. Please see:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages,
How to Create MDI Parent Window in WPF?.

I can explain what to do instead. Please see my past answers:
How to Create MDI Parent Window in WPF?,
Question on using MDI windows in WPF,
MDIContainer giving error,
How to set child forms maximized, last childform minimized.

—SA


这篇关于如何在mdiparent中检查是否有任何表单是打开的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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