I'm working on a C# program in Visual Studio 2003. The main form has a
treeview control on the left side, a splitter, and the right side of the
splitter has nothing and is used as the MDI client area. I have several MDI
child forms open (typically maximized) and can pick which child form has
focus by clicking on it's node representation in the treeview control. The
event handler for the treeview figures out which mdi child form is associated
with the selected node and does Child.Focus().

Everything works fine, except one of my forms. It is fairly long, has
AutoScroll = true, and has a vertical scrollbar even when maximized, because
of the length of the form. The form will look normal the first couple of
times I choose it's node (is maximized with a scrollbar). But eventually when
I select another form, then switch back to this form it will be resized as if
the windowstate is "Normal", even though it is actually "Maximized". The
middle controlbox button shows as if the form is maximized and I can see the
other child form maximized behind it.

If I click the "maximize" controlbox button, it will stay it's same size,
but switch to "Normal" windowstate, where I can click the "maximize" button
again to maximize it to the proper view. Also, if I've switched to this child
form so that it is in this messed up state and just start to resize the main
parent form, the mdi child form will immediately snap into the proper
maximize state. If I turn "AutoScroll" off, the child form won't ever go into
this weird state, but I don't have the scrollbar, which is needed.

This seems like a bug with the .NET framework that others might have come
across. Does anyone know what's happening or a solution?

RE: Problem with MDI child form behavior by DavidTilman

DavidTilman
Thu Jun 08 13:30:02 CDT 2006

I discovered a new trick to this. When I'm in the VS form designer and
decrease the form size so it's smaller than the area it's controls are in,
the scrollbar shows up in the design view (because some of it's controls are
outside of view of the form size). When I run the program with the smaller
default child window size, the problem doesn't appear. But when I maximize
the main form the problem happens again (this didn't happen before when the
form was maximized). Has anyone come across this bug before?


"David Tilman" wrote:

> I'm working on a C# program in Visual Studio 2003. The main form has a
> treeview control on the left side, a splitter, and the right side of the
> splitter has nothing and is used as the MDI client area. I have several MDI
> child forms open (typically maximized) and can pick which child form has
> focus by clicking on it's node representation in the treeview control. The
> event handler for the treeview figures out which mdi child form is associated
> with the selected node and does Child.Focus().
>
> Everything works fine, except one of my forms. It is fairly long, has
> AutoScroll = true, and has a vertical scrollbar even when maximized, because
> of the length of the form. The form will look normal the first couple of
> times I choose it's node (is maximized with a scrollbar). But eventually when
> I select another form, then switch back to this form it will be resized as if
> the windowstate is "Normal", even though it is actually "Maximized". The
> middle controlbox button shows as if the form is maximized and I can see the
> other child form maximized behind it.
>
> If I click the "maximize" controlbox button, it will stay it's same size,
> but switch to "Normal" windowstate, where I can click the "maximize" button
> again to maximize it to the proper view. Also, if I've switched to this child
> form so that it is in this messed up state and just start to resize the main
> parent form, the mdi child form will immediately snap into the proper
> maximize state. If I turn "AutoScroll" off, the child form won't ever go into
> this weird state, but I don't have the scrollbar, which is needed.
>
> This seems like a bug with the .NET framework that others might have come
> across. Does anyone know what's happening or a solution?