使用MDI子表单 [英] Using MDI child forms

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

问题描述

嘿!

我想要一个包含几种形式的简单应用程序.我需要的是分别创建这些表单并将其添加到Mdi父表单中,但是我找不到解决方法.请告诉我该怎么做.
(以下方式仅创建子窗体,但随后我无法根据需要设计子窗体)
Form2 newMDIChild = new Form2();
//设置子窗口的父窗体.
newMDIChild.MdiParent = this;
//显示新表单.
newMDIChild.Show();

Hey !

I want to a simple application which consists several forms. What I need is create those forms separately and add them to Mdi parent form but I can''t find a way to do that . Please tell me how to do that.
(below way only creates a child form but then I cant design child form as i need)
Form2 newMDIChild = new Form2();
// Set the Parent Form of the Child window.
newMDIChild.MdiParent = this;
// Display the new form.
newMDIChild.Show();

推荐答案

请参阅我对问题的评论.设置"MDI容器"可以解决您的问题.如果这仍不能解决您的问题,请在此处搜索关键字MDI:
http://msdn.microsoft.com/en-us/library/system. windows.forms.form.aspx [ ^ ].

这太简单了.

现在,让我们从另一个角度来看您的问题:谁曾经需要MDI?为什么要折磨自己并吓users用户?
帮自己一个忙:完全不要使用MDI.没有设计,您可以更轻松地实现设计,并且质量更高.即使Microsoft也不鼓励使用MDI,实际上,Microsoft已将其从WPF中删除,并且几乎不支持它.更重要的是,如果您使用MDI,则会吓跑所有用户.只是不要.我可以解释该怎么做.请查看我过去的答案:

在WPF中使用MDI窗口的问题 [ ^ ],
MDIContainer提供错误 [如何最大程度地设置子表单,最小化最后一个子表单 [ ^ ].

另请参阅此意见:
如何在WPF中创建MDI父窗口? [ ^ ].

并阅读以下内容:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages [
Please see my comment to the question. Setting a "MDI container" could solve your problem. If this does not resolve your problem yet, search for the keyword MDI here:
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.aspx[^].

This is way too simple.

Now, let''s look at your problem from a different point of view: : who needs MDI, ever? Why torturing yourself and scaring off your users?
Do yourself a great favor: do not use MDI at all. You can do much easier to implement design without it, with much better quality. MDI is highly discouraged even by Microsoft, in fact, Microsoft dropped it out of WPF and will hardly support it. More importantly, you will scare off all your users if you use MDI. Just don''t. I can explain what to do instead. Please see my past answers:

Question on using MDI windows in WPF[^],
MDIContainer giving error[^],
How to set child forms maximized, last childform minimized[^].

See also this opinion:
How to Create MDI Parent Window in WPF?[^].

And read this:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages[^].

Still want to do it, instead of something reasonable? :-)

—SA


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

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