Click to See Complete Forum and Search --> : MDI Oddball issues


theday_99
May 6th, 2003, 02:01 PM
Hey All,

I have an MDI parent Container, I dock a tree view control to the left of that container, and bring up various child forms on the right side of that container. Im having an issue with this, I dont want the user to beable to resize or move the child forms I bring up, I want it all done through the treeview control. When I maximize the code in the form, I set the Control Box, Minimize, and Maximize properties to false, but for some odd reason it still displays the control box and other buttons in the file menu bar of the parent container. The funny thing is, it has disabled the close and minimize buttons. Another odd point to consider is that the restore button is enabled, so if the user clicks it, my form will shrink down to its original size, but after you click the restore button and only after you click the restore button, the control box goes away. Heres the code

this.SuspendLayout();
Form cForm = new Form();
cForm.MdiParent = this;
cForm.WindowState = FormWindowState.Maximized;
cForm.FormBorderStyle = FormBorderStyle.None;
cForm.MaximizeBox = false;
cForm.MinimizeBox = false;
cForm.ControlBox = false;
cForm.Show();
this.ResumeLayout();

Any Ideas would be greatly appreciated.

Thanks,
Ryan

theday_99
May 6th, 2003, 03:42 PM
By the way, anyone else who runs into this problem might be helped but a little work around I've found. If you set the form to minimized initially, then call the form show method, and after that call the form maximized method, you get the desired effect. You just have to deal with the little annoying effect of the form going from minimized to maximized, which isnt really that bad.

Thanks,
Ryan

kaennon
June 13th, 2003, 12:16 PM
Hi

Is there a more elegant solution?:confused:

Thanks

kaennon

theday_99
June 13th, 2003, 12:47 PM
Well, I have gone in a different direction with my application. I think one of the users here suggested I use user controls, which I did. It completely fixed the flicker problem. I just simply user controls, which are alot like forms as far as methods and properties, and threw the controls in a panel. It works pretty well actually, .Net handles user created controls really well.

Hope this helps,
Ryan

kaennon
June 13th, 2003, 03:34 PM
Hi,

but working wirth form is easier because is simler built an interface with the VS form tool.

Cheers.
kaennon

medreisbach
July 14th, 2003, 08:45 PM
I've been struggling with the same BUG and prefer not to convert all of my forms into controls.

Here's the work around I finally came up with.


Control maskCtrl = new Control();
maskCtrl.Parent = this;
maskCtrl.Dock = DockStyle.Fill;
yourForm.Show();
maskCtrl.Hide();


Control maskCtrl is being used to mask Form yourForm until it has completed it's redrawing nonsense.

It's still a hack, but kaennon may find it slightly more 'eligant' and it allows one to use forms.