0

I am in a bit of a bother. I have a MDI.Parent form within it some blue pannels. When I call my child form, the child form falls behind the blue panels. I didn't expect this because the panels already existed at runtime whilst the child form is called latter (I though namely that new items alway ended up on top).

How do I fix this... Im using Vb.net for this

LabRat
  • 1,996
  • 11
  • 56
  • 91

1 Answers1

2

There's nothing to fix. That's the way it works.

When you set the IsMdiContainer property of a form to True, what actually happens is an MdiClient control is added to your form to act as a host for the child forms. The grey background you see is actually that control, not the form. When you add an MDI child form to the parent, is becomes a child control of that MdiClient.

If you were to add a GroupBox to your form and put a Panel over it and then add a Button to the GroupBox, would you expect the Button to be visible over the Panel? I would hope not, because it won't. This is no different.

The child form is basically part of the MdiClient control so anything that covers that covers the child form too. If you're trying to do otherwise then you're abusing MDI. You can add Panels and dock them to the edges of the parent form but you're not supposed to have floating controls.

With a bit of jiggery-pokery you can display an Image as a background or draw a gradient or the like but the MdiClient was not designed to host controls other than forms so you can't add controls to it either.

jmcilhinney
  • 50,448
  • 5
  • 26
  • 46
  • Jmcilhinney that makes sense. The other thing i have tried is to create a child form at load that holds the blue panels then load the "Pen styles" form as before. Though this dose work I need the new child form to be maximized however this causes my "Pen Styles" child to also become maximized dispute setting its minimum and maximum size equally to 260;300....? – LabRat Oct 28 '17 at 08:56