 MDI Maximized children forms without controlbox I have been searching the web and everywhere I asked the question, the answer is that it is a Microsoft Bug. Well instead of telling me that it is a bug, how do I fix this? My situation: I have a parent form (frmMain), a welcome/startup (or background) form (frmWelcome) and other child forms for data capturing. The idea is that when the program runs, the welcome form is displayed and stays displayed as a type of "background page", displaying outstanding jobs and other system info. All forms, when opened, must be maximized, thus eliminating the need for the minimize box or maximize box but still having the X button to close the form. In theory this task is easy, but sure enough it's not. I have created the same interface in VB6 but C# has problems with it. When I load a child form, it is maximized but then the minimize and restore bown buttons appear with the close (X) button. When I click the restore down button, all the forms (including be "background form") is reduced in size. How can it be that when I set the property in code and in design time that it still shows it? Refer to this question: http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20760384.html?query=MDI&topics=327 and http://www.dotnet247.com/247reference/msgs/33/169116.aspx Any WORKING workaround would be appreciated. |
| Pieter Coetzer - South Africa Monday, April 11, 2005 2:26 PM |
Well, I looked into this issue and there are several options  First off this background form, why not make it just a dockStyle.fill So for example this maybe what the code would look like if you where to start up the app for this welcome form. | | Form2 frm = new Form2(); frm.MinimizeBox = false; frm.MaximizeBox = false; frm.MdiParent = this; frm.ControlBox = false; frm.Dock = DockStyle.Fill; frm.Show(); | Now the one downside to this is that you can still move the form, but if you minimize the main form or whatever it will just go back to being the full size of the MDI parent. as for the Customer windows or whatever same code except you get rid of frm.ControlBox = flase; So now it looks like: | | Form2 frm = new Form2(); frm.MinimizeBox = false; frm.MaximizeBox = false; frm.MdiParent = this; frm.Dock = DockStyle.Fill; frm.Show(); | Its dirty but it works for the current time being |
| wacko Tuesday, April 12, 2005 3:29 AM |
Well, I looked into this issue and there are several options  First off this background form, why not make it just a dockStyle.fill So for example this maybe what the code would look like if you where to start up the app for this welcome form. | | Form2 frm = new Form2(); frm.MinimizeBox = false; frm.MaximizeBox = false; frm.MdiParent = this; frm.ControlBox = false; frm.Dock = DockStyle.Fill; frm.Show(); | Now the one downside to this is that you can still move the form, but if you minimize the main form or whatever it will just go back to being the full size of the MDI parent. as for the Customer windows or whatever same code except you get rid of frm.ControlBox = flase; So now it looks like: | | Form2 frm = new Form2(); frm.MinimizeBox = false; frm.MaximizeBox = false; frm.MdiParent = this; frm.Dock = DockStyle.Fill; frm.Show(); | Its dirty but it works for the current time being |
| wacko Tuesday, April 12, 2005 3:29 AM |
Thank you for your reply. I found your code very helpful. I have 2 options: One is to completely take away the ControlBox and make the form border nothing, letting the user navigate using the menus (and a window list menu) in the main/parent page. The down side is that the user will not be able to close the form using the normal X (close) button. My other option is to only display the close (X) button and nothing else, but for some reason the child form menu (containing Restore, Minimize and Maximize...) and the Restore, minimize (disabled) and close buttons (disabled) still appears. When the user clicks the restore down button all the forms reduce in size. It looks to me that the "this.MaximizeBox = false", "this.MinimizeBox = false" and "this.ControlBox = false" does not work as wanted. Huge bug if you ask me.  Any suggestions on how to override the control box and not to display it at all? |
| Pieter Coetzer - South Africa Tuesday, April 12, 2005 5:49 AM |
can you post a little more of your code because I am not getting those resualts at all. I do not see the those box's unless the form is set to state of maximize which you will see those box's thus why i gave a work around to make the box the size of the MDI Window. |
| wacko Tuesday, April 12, 2005 6:21 AM |
My apologies! In my haste I forgot to set the WindowState to normal (it was set to maximized). Your solution does work! Thanks! I hope they will fix this bug in ver. 2 of the FW. |
| Pieter Coetzer - South Africa Tuesday, April 12, 2005 7:16 AM |
np, glad I could help  and looking in the 2.0 fw it does not look it changes much and I do not think its a property of the form but of the menu itself. For what ever reason when you max out the form it add it to the menu which in turn enables the props... Which could or could not be a bug.. That could be the way it is |
| wacko Tuesday, April 12, 2005 7:17 AM |
That thing looks simple and working, but tell me this... When we have several children to the main mdi form and we want some of them to have the property to maximize and some cannot.. In that case, when you maximize one form and open the other, which is not supposed to maximize, it would still maximize. Any ideas on this one??? -- Nishant |
| Nishant Wednesday, May 11, 2005 7:21 PM |
I have been wondering about this too, so if anyone has any insight, I would be glad to know!
Eyvind. |
| Eyvind Thursday, May 12, 2005 6:54 AM |
Sorry its taken me so long to get back to you :) Is it a seperate form or is it the same form that was originally maximized ? I mean if it was a totally different form you could make it so it does not maximize ... If it was the same form , I would have to look at that. |
| wacko Tuesday, June 07, 2005 10:56 PM |
In MDI, if one child is maximized, all children are maximized. |
| durstin Tuesday, June 28, 2005 9:44 PM |
Hi, Form your post: "can you post a little more of your code because I am not getting those resualts at all. I do not see the those box's unless the form is set to state of maximize which you will see those box's thus why i gave a work around to make the box the size of the MDI Window."
You mean that we can not hide these boxes and set child to state of maximize at the same time. I want to get these two at the same time. Is it possible or not? Any help,
Thanks a lot. |
| SamsamSam Tuesday, July 19, 2005 3:27 PM |
I have the same exact problem.
My situation is a little different. I have a series of independent forms (coming from modules/assemblies). I want to run these forms inside of a control application (that has a menu, etc...). So my goal was to write an MDI window where the children would be maximized, thus gaining the ability to have a central program/form control the displaying of all the other children forms.
But, sadly, the same problem. What is even MORE bizarre is:
After you maximize a child window with no min/max/control box, then get the restore box, and restore it ... a greyed out close box appears on the form with no control box!
This has to be a bug. I'm going to report it, with sample code to MS. I encourage other people to as well. |
| Meatnog Friday, July 22, 2005 6:37 PM |
ok im noob at vb.net app develomnt .. i came across the same issue .. tried this code and it did work ... but i needed a bit more ... this code works fine for me in these ways: when mdi is in maximised mode at form load ive to minimise the mdi window and restore it OR i open the mdi window in normal state and manually maximise the mdi window .. in mdi maximised mode at form load the initial display of the welcome form is its normal size .. how do i make both mdi & welcome form maximised at load time ?
this is the code that i used (the same as above) ..
Dim frmMainScreen As New MainScreen frmMainScreen.MinimizeBox = False frmMainScreen.MaximizeBox = False frmMainScreen.MdiParent = Me frmMainScreen.ControlBox = False frmMainScreen.Dock = DockStyle.Fill frmMainScreen.Show()
also is it possible .. say i want the default application to have btn,grids labels etc in the same way instead of the welcome form place all those in the mdi itself .. now normally all controls in mdi get on top of all forms called aftrwards .. can i make the mdi controls to be in the back .. ?
|
| RenjithC Wednesday, November 16, 2005 5:45 PM |
Well, 2.0 is out and they DIDN'T FIX THIS *@&#ing BUG. Thank you Microsoft! All I want is that when I have a maximized child MDI it stays maximized. If I hide it and show it, it should STAY MAXIMIZED. And if I tell a controlbox to go away it SHOULD NEVER EVER COME BACK. This is driving me batty, I don't know about you guys but this bug is causing me massive headaches in my program. |
| Meatnog Wednesday, December 07, 2005 9:09 PM |
Oh, for added fun do this:
Make an MDI child window. Tell it to maximize then show() itself. Then, for fun, tell it to show() again and see how it gets all screwed up. |
| Meatnog Wednesday, December 07, 2005 9:27 PM |
Has anyone made any progress on this problem?
I see there have been no updates since last July. I'm getting the same problem and it is a pain.
Has it been accepted as a bug? Will it be fixed?
Ray
|
| Ray Maddock Friday, March 17, 2006 1:34 PM |
Of course not, that would require Microsoft actually listening to bug reports and caring that they get fixed.
This has existed since .NET 1.0
It was not fixed in 1.1
It was not fixed in 2.0
|
| Meatnog Friday, March 17, 2006 2:03 PM |
18 months later, still no fix.
Hey microsoft, can we PLEASE get a fix for this UI bug? |
| Meatnog Thursday, November 08, 2007 4:44 PM |
|
| SweetGuM Thursday, November 08, 2007 10:43 PM |
I have had the same problem. When I show an MDI child window maximized it appears "a-kind-of-maziximized" but it is not really maximized. Even setting the Dock property toDockStyle.Fill does not help has the caption bar still appears.
I manage to show the window maximized like this:
myForm.MdiParent = this;
myForm.WindowState = FormWindowState.Normal;
myForm.Show();
myForm.WindowState = FormWindowState.Maximized;
It provides the result I need but the window flickers a little.
Another option is to do it like this:
myForm.MdiParent = this;
myForm.WindowState = FormWindowState.Minimized;
myForm.Show();
myForm.WindowState = FormWindowState.Maximized;
It still kind of flickers but gives a "nice"(?!) transition effect |
| IsoKaapo Thursday, May 22, 2008 8:22 AM |
void MdiContainer_MdiChildActivate(object sender, EventArgs e) { //WindowState Normal child.MinimizeBox = false; child.MaximizeBox = false; child.FormBorderStyle = FormBorderStyle.None; child.Dock = DockStyle.Fill; } works for me |
| Pawel_extreme Thursday, August 27, 2009 11:53 AM |