child form control box

Arg81

Well-known member
Joined
Mar 11, 2005
Messages
949
Location
Midlands, UK
Programming Experience
1-3
Hi Guys,

Even though I have set each individual form to not show the control box (minimise, maximise, close), when it is opened as a child form in my MDI container then a control box is shown.

Is there any way to get around this, or is it a bug with the way the MDI container opens child forms?

cheers,
Luke
 
What code? My whole project?!?!

Basically each form is set on the properties tab to have controlbox = FALSE.

Then on my main menu, when an item is clicked it does the following;

dim frm as new frmForm1
frm.MDIParent = me
frm.show

......that's the same for every form opened on the main menu.

Luke
 
Well, i thought you set that programatically :eek:
VB.NET:
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Me.ControlBox = False 

End Sub

Otherwise it is not bug at all ... actually, take a look at the attached project below


Cheers ;)
 

Attachments

  • ControlBoxProperty.zip
    27.8 KB · Views: 33
sorry, slight misunderstanding, I assumed you wanted the whole lot!!! hehe....

downloaded the zip and looking at now...cheers!!

ah ha - forgot to mention that I maximise each form within the MDI Parent :rolleyes: , so when you're example Form 2 is maximised, it shows the control box for that form, even though it is set not to....
 
Just Don't touch anything within properties window but rather put this code in load event ... as it follows:
VB.NET:
Private [/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] Form2_Load([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Object, [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.EventArgs) [/size][size=2][color=#0000ff]Handles [/color][/size][size=2][color=#0000ff]MyBase[/color][/size][size=2].Load
 
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].ControlBox = [/size][size=2][color=#0000ff]False
 
[/color][/size][size=2][color=#0000ff]Me[/color][/size][size=2].WindowState = FormWindowState.Maximized
 
[/size][size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]Sub

Cheers ;)
 
Sussed it - think it's a bug???

If WindowState is set to something other than Normal in properties, and having me.windowsstate=windowsstate.maximised and me.controlbox = False set on Form_Load, the form will still show the Control Box.

Resetting the property to Normal, then having Me.WindowState = WindowState.Maximised on form load (with me.ControlBox = False), the control box doesn't show.

Thanks!
Luke
 
Back
Top