PRB: MDI Child Form Painted Twice When Moved Before Loaded
Article ID: 109801
Article Last Modified on 1/8/2003
APPLIES TO
- Microsoft Visual Basic 3.0 Professional Edition
This article was previously published under Q109801
SYMPTOMS
If you Load an MDI child form and then change the position or size of the
MDI child form, it gets painted twice -- once in a default starting
position and then in its final position.
CAUSE
When you access any properties of a form that is not currently loaded, the
form is loaded immediately. Note that the Move method simply sets the Left,
Top, Width, and Height form properties. Since MDI child forms cannot have
their Visible property False, they cannot be loaded without being Visible.
Therefore, when you try to set the position or size properties of an MDI
child form before showing it, the MDI child form appears in a default
position before your new settings take effect.
RESOLUTION
Initialize the position of MDI child forms from within their own Form_Load
event handler. The Form_Load event handler is executed before the form
actually becomes visible.
Additional query words: 3.00
Keywords: kbprb KB109801