开发者

Child Form Size Set to the MDI Form's MDI Container's Size

I'd like to know how I can have a child form load up with it's size covering the complete MDI Parent's MDI container space (the dark-gray thing)? Setting the child form's WindowState to Maximized is not an option as it'll maximize any开发者_C百科 other form too. Suggestions?


I think this code should do it:

Form childForm = new Form();
f.Left = 0;
f.Top = 0;
f.Size = ParentForm.ClientRectangle.Size;


http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/a315cefe-fe7f-4e23-b3e0-6cf614501ac2/ check the link the issue is resolved by inheriting the size


I added a couple of lines to get it to fit inside the frame and it works well.

Form childForm = new Form();
childForm.Left = 0;
childForm.Top = 0;
Rectangle recNew = new Rectangle();
recNew = ParentForm.ClientRectangle;
recNew.Height -= 4;
recNew.Width -= 4;
childForm .Size = recNew.Size;

I hope that helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜