Set Starting size for a child form

Is there any way to set the starting size for a child window in a mdi form. Whenever I open the child form it sizes it based on the size of the parent form, instead of using the size I set for it in the designer. I use Form2.Size = New Size(640, 480). Is there another way



Answer this question

Set Starting size for a child form

  • reukiodo

    Two things I don't know: What a "mdi" form is, and what causes your problem.

    But in normal windows forms, I have Not experienced your problem, where the design properties are not utilized at Run time.

    I have resized windows forms at run time, based on user selection. Could you try (as a work around) to resize the child form at Run time, before the form is displayed


  • Engr.Faisal

    An MDI (Multiple Document Interface) child form can be programmatically sized. After you assign the MDIParent property to it, just prior to "show"ing it, set it's size New Size (640,480)

    For those of you confused about this, the MDI is the type of interface that Visual Studio uses (as well as older versions of MS Office, etc). Whereas your document forms are children of your main (parent) form.



  • Ricardo UY

    Make sure that the WindowState property of the child form is set to Normal. If it is, you should not need to set the size of the form programatically--it should default to whatever size it is set to in the designer.
  • knightmare

    I think the problem was that it had fixed border. what it would do is when the form was shown it would resize it depending on the size of the parent form, so that it could be seen fully without scrolling. Weird

    Also, an MDI is a multiple document interface. http://en.wikipedia.org/wiki/Multiple_document_interface



  • Set Starting size for a child form