Question on MDI Forms Resizing and .Net Bug

  • Thread starter Thread starter T Waldren
  • Start date Start date
T

T Waldren

When using an C# MDI Form, I have set the Child form's Minimize and Maximize
buttons to false, so they do not show up. But when I maximize the program
to fit a larger size window then what the default size is of the MDI Parent
is set to (programming this for a specific screen size), the Maximize and
Minimize buttons show up on the child form which can cause issues if someone
inadvertently uses them

I know this has been discussed before, and people have stated it is a bug in
..Net.

What I was wondering is if there are any examples of a code snippet that
finds the Size of the MDI Parent, then changes the size of the MDI Child
(similar to maximizing the Child form) so that the MDI Child will then be
"maximized" without initating that part of the .Net code. I was wondering
if by doing that throw separate code, the maximize and minimize buttons
would then not appear, and I could get around this problem.

Does anyone know of any examples, or something that could lead me down a
path to solving this?

Thanks,

T.Waldren
 
Have been waiting on the same thing. Hopefully someone out there knows how
to disable this behaviour.
 
Hmm, I guess I didn't explain that too well.

I have an application that has its heigth and width set to something that
would fit on an 800x600 resolution monitor (this was requested, not my
choice). So, I have created an MDI application with a few child forms. The
problem is as follows. When you set a child form to be maximized to the
parents size, so the application loads at 800x600. Now, if I test this file
on a machine running 1024x768, and then use the Maximize button on the
Parent form to make the program fill the entire screen, for some reason the
Maximize and Minimize features - which I turned off in their properties -
show up on the child form.

I am trying to make it so that the Maximize and Minimize boxes are not
present on a Child form. I would like the child forms to be present but
without any those types of user controls. I tried to get around this by not
making my panels, tab controls, etc Dock to none, thus, which in most cases
has removed this problem.

But that is not the best solution. So what I would like to do is create a
program that when a user maximizes the Parent form, the program then runs to
change the size of say a Tab Control on the child form that is open (or any
child form that opens) thus allowing them to be full screen, but without the
maximize and minimize buttons that seemingly appear out of no where after I
set their properties to false. Maybe this is a problem with Visual Studio
2003, I am not sure.

But I know that even after I turn the MaximizeBox and MinimizeBox to false
on a child form, they still appear, and I would like to keep that from
happening.

T.Waldren
 
I see your point. Simply setting the WindowsState to Maximized causes the
controls to be re-enabled!
 
Hi ,

Based on my understanding, the issue is:
In the MDI application, if you removed the child form's minimize and
maximize buttons, while you set the child form's windowstate to maximized.
Then the child form will still have the minimize and maximize buttons.

If I misunderstand you, can you paste a screen shot for this issue?

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
The following snippet should simulate the behavior that you are looking for:

Form2 frm = new Form2();
frm.MdiParent = this;
frm.FormBorderStyle = FormBorderStyle.None;
frm.ControlBox = false;
frm.MinimizeBox = false;
frm.MaximizeBox = false;
frm.Show();
frm.Dock = DockStyle.Fill;

Trevor Germain, CET, MCP
i-Gen Solutions, Inc.

T Waldren said:
That is correct.

I took two screen shots of a simple MDI program. The first shows the
VisualStudio interface with the Maximize and Minimize properties of the
ChildForm set to False. The second is a screen shot of the application
showing the Minimize and Maximize buttons to be present even though their
properties are set to false.

My only solution to this so far has been to keep the Child form from being
set to Maximize (set the WindowState to Normal) but this means that it
doesn't change the form's size for different resolutions, which goes back to
my original question of programatically changing the Width and Height of a
child form.

T.Waldren


"Jeffrey Tan[MSFT]" said:
Hi ,

Based on my understanding, the issue is:
In the MDI application, if you removed the child form's minimize and
maximize buttons, while you set the child form's windowstate to maximized.
Then the child form will still have the minimize and maximize buttons.

If I misunderstand you, can you paste a screen shot for this issue?

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Thanks Trevor

That sorted my issue out.


Trevor Germain said:
The following snippet should simulate the behavior that you are looking for:

Form2 frm = new Form2();
frm.MdiParent = this;
frm.FormBorderStyle = FormBorderStyle.None;
frm.ControlBox = false;
frm.MinimizeBox = false;
frm.MaximizeBox = false;
frm.Show();
frm.Dock = DockStyle.Fill;

Trevor Germain, CET, MCP
i-Gen Solutions, Inc.

T Waldren said:
That is correct.

I took two screen shots of a simple MDI program. The first shows the
VisualStudio interface with the Maximize and Minimize properties of the
ChildForm set to False. The second is a screen shot of the application
showing the Minimize and Maximize buttons to be present even though their
properties are set to false.

My only solution to this so far has been to keep the Child form from being
set to Maximize (set the WindowState to Normal) but this means that it
doesn't change the form's size for different resolutions, which goes
back
to
my original question of programatically changing the Width and Height of a
child form.

T.Waldren


"Jeffrey Tan[MSFT]" said:
Hi ,

Based on my understanding, the issue is:
In the MDI application, if you removed the child form's minimize and
maximize buttons, while you set the child form's windowstate to maximized.
Then the child form will still have the minimize and maximize buttons.

If I misunderstand you, can you paste a screen shot for this issue?

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top