如何在父MDI表单中停止子表单的拉伸 [英] How to stop the stretching of child form within Parent MDI form

查看:61
本文介绍了如何在父MDI表单中停止子表单的拉伸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个带有MDI容器表单的Windows桌面应用程序,它将首先打开。这个MDI表单包含许多子表单作为其菜单的一部分。在这个菜单项的点击事件中,我写了以下代码。



Masters.frmCustomer objCUST = new Masters.frmCustomer();

//objCUST.MdiParent = this;

objCUST.Show();



我的问题是当我执行应用程序时第二个声明评论说,子表单打开完全正常(以其自己的原始形状)。当我取消对第二个语句的注释时,子表单在父窗口内显示完全拉伸 - 正在取消表单结构。所以请建议我一个解决方案,我可以在MDI窗口内维护开放子窗体的正确结构。



我正在使用VC#2010。



谢谢,



IB

解决方案

更改child形成WindowState到FormWindowState.Normal


除了做OriginalGriff建议你做的事情:检查'frmCustomer的加载或显示的事件(如果已定义)中的任何内容Form视觉状态的任何方面,如WindowState,StartUpPosition等。注释掉该代码是否存在。



尝试将'frmCustomer的StartPosition设置为'WindowsDefaultLocation,或者'手册,看看是否有任何影响。



如果您使用的是标准Windows窗体并将其添加到代码中,那么您所描述的绝对不会发生Mdi Container的标准方法,然后设置他们的M. diParent to Mdi Container Form。


这是一个想法:谁需要MDI?为什么要折磨自己并吓跑你的用户?

帮自己一个大忙:根本不要使用MDI。没有它,您可以更轻松地实现设计,质量更好。 MDI甚至被微软高度劝阻,事实上,微软将其从WPF中删除并且很难支持它。更重要的是,如果您使用MDI,您将吓跑所有用户。只是不要。请参阅:

http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages [ ^ ],

如何在WPF中创建MDI父窗口? [ ^ ]。



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

如何在WPF中创建MDI父窗口? [解决方案2 ],

关于在WPF中使用MDI窗口的问题 [ ^ ],

麦当劳给出错误 [ ^ ],

如何设置子窗体最大化,最后一个子窗体最小化 [ ^ ]。



-SA

I have developed a Windows Desktop Application with a MDI Container form which will open first. This MDI form houses many child forms as part of its Menu. On the click event of this menu items I have written the following code.

Masters.frmCustomer objCUST = new Masters.frmCustomer();
//objCUST.MdiParent = this;
objCUST.Show();

My problem is when I am executing the application with the second statement commented, the child form opens perfectly OK (in its own original shape). Bust as I un-comment the second statement the child form appears fully stretched inside the parent window - dis-forming the form structure. So please suggest me a solution where I can maintain the proper structure of the opening child forms inside the MDI window.

I am using VC# 2010.

Thanks,

IB

解决方案

Change the child forms WindowState to FormWindowState.Normal


In addition to doing what OriginalGriff advised you to do: check to see there's anything in 'frmCustomer's Load or Shown Events (if they are defined) that is setting any aspect of the Form visual state, like WindowState, StartUpPosition, etc. Comment out that code if it is present.

Try setting 'frmCustomer's StartPosition to 'WindowsDefaultLocation, or 'Manual, to see if that has any effect.

What you describe should definitely not be happening, if you are using standard Windows Forms and adding them in code in the standard way to an Mdi Container, then setting their MdiParent to the Mdi Container Form.


Here is the idea: 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. 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? [Solution 2],
Question on using MDI windows in WPF[^],
MDIContainer giving error[^],
How to set child forms maximized, last childform minimized[^].

—SA


这篇关于如何在父MDI表单中停止子表单的拉伸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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