2
votes

I have a groupBox on my form with AutoSize=true and Dock=Top. It contains a tableLayoutPanel which also has AutoSize=true and Dock=Top. When the label on the top of tableLayoutPanel takes only one line of text everything is ok:

Normal layout of the groupBox

But when it takes more then one line, it cuts off a part of its content:

Wrong layout of the groupBox

If I'm changing the height of the groupBox on tableLayoutPanel.Resize event then I have a bug with scrollbar:

enter image description here

It happens when scrollbar becomes visible and changes the size of my label so it takes more lines of text. Can anyone suggest me how to handle this problem?

1

1 Answers

0
votes

On tableLayoutPanel.Resize event I'm changing groupBox.Height and leave some free space at the bottom to include possible difference in height. The solution is not perfect but at least it allows to avoid those bugs.