• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 36
  • Last Modified:

Winforms form layout not working as expected

I have a Winforms form that is laid out like the image below. I'm having difficulties getting the thing to be responsive and have the controls expand and contract correctly.

The maroon boxes are panels that are docked top and bottom.
The purple and blue boxes are panels docked Bottom.
The orange boxes is contained inside the purple panel and is docked Left.
The green box is contained inside the purple panel and is docked Fill.
The brown boxes are contained inside the green panel and docked Bottom and Fill.

The bottom maroon panels stay fixed, like it should, however, the top maroon panel grows in height. The purple and blue panels grown in width but not in height. And the orange panel doesn't grow at all, however the green and brown panels grow in width only.

Apparently I'm not doing this correctly, it doesn't stretch quite like I thought it would.

I'm kind of new at this Winforms layout stuff, been doing web development for too long.


Before publish update: I figured it out, already, I needed to make the blue panel Fill also. Now everything works as expected, this will be deleted once it is published.
layout.png
0
Eddie Shipman
Asked:
Eddie Shipman
  • 2
1 Solution
 
Russ SuterCommented:
For controls that you want to grow and shrink with their parent containers, you need to use the Anchor property rather than the dock property. If you want multiple controls to grow proportionally then you'll have to handle the resize event manually and do some calculations.
0
 
Eddie ShipmanAll-around developerAuthor Commented:
If I set the Anchors, the controls "disappear" in the designer.
0
 
Eddie ShipmanAll-around developerAuthor Commented:
good
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now