Reputation: 4173
I have a form
(600x500 px). In this form
there are 2 groupboxes
. The first one being 260 px and the second one 330 px.
What I would like is that when I resize the form
, those two boxes resize with it, but by keeping the proportions. (the second one bigger then the first).
No matter how I set the Anchor
points, I dont seem to be able to do this.
Upvotes: 1
Views: 1569
Reputation: 8647
You can achieve that with a TableLayoutPanel
like this:
TableLayoutPanel
on your Form
. Set the anchor to Left
, Top
, right
(and Bottom
in needed) or set Dock property to Fill
TableLayoutPanel
(by default there is two columns and two rows, so remove the last row)GroupBoxs
to each cellFill
or Top
for each GroupBox
System.Windows.Forms.SizeType.Percent
, so just adjust the first column with in designer as you need.Result:
Before resizing
After resizing (image is reduced so you can see that it keeps proportion)
Upvotes: 1