I have a panel with a groupbox inside of it. I'd like the groupbox to grow and shrink as the panel is resized. However, the panel has 2 controls that will be placed above the groupbox. I want to groupbox to always stay beneath those controls.
Since I want it to resize automatically, I've turned on AutoSize. If I use dock, it of course ignores the location I've set. I can't seem to make anchors actually do anything.
How can I make the groupbox respect the location I set, but expand to fill the panel downwards and to the left and right?
I don't see what's the problem, if I understand the question, the WinForms designer is perfectly capable of setting this up. Isn't this working?
this.groupBox.Anchor = AnchorStyles.Top |
AnchorStyles.Bottom |
AnchorStyles.Left |
AnchorStyles.Right;



If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With