Windows Develop Bookmark and Share   
 index > Windows Forms General > VS 2005 - MDI Child forms not displaying correctly
 

VS 2005 - MDI Child forms not displaying correctly

Hi

I want my MDI child forms maximised by default. I set the WindowState property to maximised, but when I run the application, only the top leftquadrant of the MDI parent is filled. The control box shows that its maximised, but it doesnt fill the space. Only once I open another child form, does it fill the space.

Any ideas what I am doing wrong?

Regards

John

John.Scott  Saturday, September 29, 2007 10:52 AM

Hi John,

Do not set the MDI child form to maximized in the child form’s InitializeComponent method. Set it in the child form’s load event instead. Try like the following:

Code Block

partial class ChildFrm1 : Form

public ChildFrm1()

//this.WindowState = FormWindowState.Maximized; --this won�/span>//this.WindowState = FormWindowState.Maximized; --this works

private void ChildFrm1_Load(object sender, EventArgs e)

this.WindowState = FormWindowState.Maximized; //--this works

Hope this helps.
Best regards.
Rong-Chun Zhang

Rong-Chun Zhang  Monday, October 01, 2007 12:25 PM
try to use Refresh() method for the form , it redraw the control and all its children
hope to work
bola shokry  Saturday, September 29, 2007 12:02 PM

No, refresh didn't make a difference.

Thanks anyway

John.Scott  Saturday, September 29, 2007 1:10 PM

Hi John,

Do not set the MDI child form to maximized in the child form’s InitializeComponent method. Set it in the child form’s load event instead. Try like the following:

Code Block

partial class ChildFrm1 : Form

public ChildFrm1()

//this.WindowState = FormWindowState.Maximized; --this won�/span>//this.WindowState = FormWindowState.Maximized; --this works

private void ChildFrm1_Load(object sender, EventArgs e)

this.WindowState = FormWindowState.Maximized; //--this works

Hope this helps.
Best regards.
Rong-Chun Zhang

Rong-Chun Zhang  Monday, October 01, 2007 12:25 PM

You can use google to search for other answers

Custom Search

More Threads

• How do I override F10 and use it in internal shortcut command?
• How to fire an event
• How do I host Windows Forms Controls which are having dependencies in Internet Explorer?
• Just can't close the form
• Please can anybody help (1 month before release)?
• MDIContainer Problem
• Batch Commands
• RichTextBox memory leak
• setting hotkeys for macro's in a vb.net
• How difficult would this be? Drag/Drop with DB update?