Click to See Complete Forum and Search --> : Forms come up with the wrong size!


Chris Boebel
March 11th, 1999, 01:13 PM
Greetings.


I have an MDI application. In design mode, my forms are all the size that I specify. When I create an instance of the form, then set its visible property to TRUE, the form comes up much larger than I specify.


What causes this?

Chris Eastwood
March 12th, 1999, 03:51 AM
Hi


This is standard behavior due to the MDI framework. You'll need to size your form on the Activate or Load event - or make it non-sizable.


Regards


Chris Eastwood


CodeGuru - the website for developers

http://www.codeguru.com/vb

Chris Boebel
March 12th, 1999, 02:02 PM
Thanks. Right after I received your response I found an entry in MSDN that verified what you said. I guess the question now becomes...


Is there any way to know how windows will size an MDI child form before it comes up?


By the way, thanks for your help.

Tran
August 27th, 1999, 01:20 PM
Put your resizing code in the resize method of the form.
This method is called whenever the form is created, resized, minimized or maximized.

Ravi Kiran
August 27th, 1999, 09:52 PM
You can set the AutoShowChildren property to False, so that when a child form is loaded, it will not automatically show. You can then set the chilf Form size explicitely if you want in the MDI form code (after child form load)
May be you can use GetClientRect api call to get the MDI client size and position your child form accordingly.

In the Child form code:
you can use the Form_Resize event to set the size, to a predefined size.
Form_Activate also can be used with a static variable, so that only first time the size is set.
Form_Load is the best, ofcourse.