Question

The MDI child forms, when shown, display their title bars for a split second. Then the forms are loaded normally. Is there any way for the forms to load without showing the title bar and form border. This is what happens...

alt text

alt text

Was it helpful?

Solution

Not sure I see it from the screenshots. But the complaint is a familiar one. MDI really dislikes a maximized child window. When you display a new child window and make it maximized as well then it needs to go through a song-and-dance. First it restores the current child so it is no longer maximized. Then creates the new child and sets the focus to it. Then maximizes it. Those intermediate steps are visible and can produce a good amount of flicker when drawing the child is expensive. Yours look expensive. You cannot suppress the painting.

If you always display your MDI child windows maximized then MDI is the wrong form model to use. Just use a simple form, make the child 'windows' user controls. You can even rescue your current child forms by setting their TopLevel property to false, that turns them into controls. Set FormBorderStyle to None and Visible to true.

OTHER TIPS

I had this problem even when the MDI child window was not maximized, the child's title bar was momentarily displayed when the child form was shown. I got around it by setting the child form's top to the height of the parent so that the form was not visible while it was being shown. I then set the child's top back to 0.

This worked until I tried to dock the child in the parent so that the child would be automatically resized as the parent's size was changed. This put me back to square one. I overcame the problem this time by adding a hidden panel to the parent, setting the size and position of the panel to the size and postion of the parent's MdiClient control, making the panel visible just before showing the child, and hiding the panel when this is done. 'Not pretty but it works until I can figure out a better way around it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top