Anthony
Anthony

Reputation: 923

Winform group box is eating my button

I have a WinForms group box that needs to be sized programmatically.

Everything else is working well but I am having trouble with the below line of code because as the form is re-sized larger the group box grows over the buttons that are underneath.

I am looking for a way in code so that the group box grows with the form, but no so large that it grows over the button underneath it.

Const VerticalBuffer As Integer = 10
GroupBox1.Height = ((Me.Height - (3 * VerticalBuffer + 420)) * 0.33)

Upvotes: 0

Views: 467

Answers (1)

Denis Biondic
Denis Biondic

Reputation: 8201

Does Anchoring help ? Try setting anchor on the buttons to bottom-right, when form resizes it will follow beneath; but for GroupBox anchor should work too, I think if you set the anchors on group box and resize it, the form should grow.

Upvotes: 2

Related Questions