如何以完整屏幕大小的父窗体设置子窗体 [英] How to set the child form in parent form with full screen size

查看:190
本文介绍了如何以完整屏幕大小的父窗体设置子窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友



我有一个带有menustrip控制和很多子形式的父表格。当我单击子窗体时,它将作为父窗体内的一个小窗口打开。但我想打开具有相同宽度的父窗体的所有子窗口。我将窗体最大化为窗口大小。但我想打开像msword或记事本。

解决方案





这是代码< pre lang =c#> Childform cf = new Childform();
cf .MdiParent = ;
cf .ClientSize = new System.Drawing.Size( 2000 800 );
this .WindowState = System.Windows.Forms.FormWindowState.Maximized;
cf .FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
cf .Dock = DockStyle.Fill;
cf .Show();





别忘了改变锚属性。我希望这会有所帮助。


听起来你已经构建了一个MDI应用程序 - 在这种情况下,所有子代都包含在父应用程序的边框内,并且不能大于父母的客户区域。您可以非常轻松地让孩子填写父客户区:只需将 WindowState 属性设置为 FormWindowState.Maximized 但是你不能让它填满屏幕,或出现在父母的界限之外。



为了让孩子在外面,你必须在展示之前不要设置MDIParent属性表格。


Hi friends

I have one parent form with menustrip control and lot of child form. when i click child form it open as a small window inside the parent form. but i would like to open all child window with same width of parent form.here i maximize the form to windows size. but i want to open like msword or notepad.

解决方案

Hi,

Here is the code

Childform cf = new Childform ();
           cf .MdiParent = this;
           cf .ClientSize = new System.Drawing.Size(2000, 800);
           this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
           cf .FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
           cf .Dock = DockStyle.Fill;
           cf .Show();



Don''t forget to change anchor properties. I hope this helps.


It sounds like you have built an MDI application - in this case, all the children are contained within the border of the parent application, and cannot be any larger than the client area of the parent. You can make a child fill teh parent client area very easily: just set the WindowState property to FormWindowState.Maximized but you cannot make it fill the screen, or appear outside the bound of the parent.

To get the child outside, you have to just not set the MDIParent property before you show the form.


这篇关于如何以完整屏幕大小的父窗体设置子窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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