Layout manager issue when docking panels?

K

Kerry Sanders

I was playing around with a new Windows form yesterday. I wanted to drop two
panels on the form. The first would be set Dock=Top. The second would be set
Dock=Fill.

So, I dropped the first panel and set its Dock property to Top. I then dropped
the second panel on the form and set its Dock property to Fill.

Holy disappearing panels, Batman. The second panel filled the entire form
hiding the first panel. So, when I dropped my grid control on the second panel
which was set to Dock=Fill, it filled the entire screen.

I eventually got what I needed by cutting and pasting the controls, which was a
suggestion of a fellow developer at work, but it was a bit annoying.

Is there a bug in the layout manager in the forms designer that is causing this
behavior?
 
N

Noah Coad [MCP & MVP]

This is typically due to the Z-ordering of the controls on the form. The
Z-order effects which controls are "on top" of other controls (the 3D
dimension to 2D graphics). You can right-click on a control (such as the
panel) and use the "Bring to Front" and "Send to Back" to change the
Z-ordering of a control.

Actually, when repeating the operation you describe below, I could not
reproduce the exact results with VS.NET 2003. But hopefully the above
mentioned Z-ordering will help if this occurs in the future.

Cheers,

-Noah Coad
Microsoft MVP & MCP
 
L

Lawrence Thurman

Actually it is a bug in VS.Net 2002 that was fixed in VS.Net 2003

It invloves the order that you are adding the panels to the form
You need to drop the panel that you want to Dock=Fill first
Set Dock=Fill
then you can drop the panel that you want to Dock=Top next
Set Dock =Top
 
K

Kerry Sanders

Thanks for the replies everyone. I am not sure if the
issue has been fixed, because I definited duplicated it
yesterday in .Net 2003 as have others in our office.

Anyway, thanks for the tip on the order in which the
panels should be dropped. Much appreciated!
 
K

Kerry Sanders

It invloves the order that you are adding the panels to the form
You need to drop the panel that you want to Dock=Fill first
Set Dock=Fill
then you can drop the panel that you want to Dock=Top next
Set Dock =Top


I just how had a chance to try this out. This tip worked perfectly. Thanks
again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top