0
votes

I'm having difficulty with resizing controls in two panels...

I have a form with two panels stacked on top of each other. The top panel takes up 38% of the form and the bottom panel takes up 58% of the form and a 4% gap between.I have a tab control in one and group box in the other.

I've been trying to perform fills/docks within the panels that will cause all controls to grow and shrink with the panel's size. In other words I'm trying to keep the same space and size percents for all controls based on the form size. Visual studios keeps crashing when trying different fills/docks and I don't want to calculate size percents and x/y coordinates for each control. Is there a way to set up the fill within the panel or container so that it looks almost the same at most sizes?

1
May be worth taking a look at the TableLayoutPanel control. In winforms, I often use those as an easy way to control resize scaling/positioning. It's like an invisible table you can use to set row/column sizes as either fixed or percentages of the parent. If the TableLayoutPanel's dock is set to fill along with its child controls, all the resizing is handled for you according to the pixel/percent values you've set when the window or panel sizes are changedsoohoonigan

1 Answers

0
votes

In my experience, docking causes more problems than it helps. What I do instead, is undock the controls and then anchor them on all sides. Then I size them within the panel how I want them. Then, if the panel is ever resized, the controls anchored within them will resize accordingly and it will stay within the boundaries like I want it to. Try that.