In TableLayoutPanel if we set AutoSize = true and Dock = fill then last column/row will occupy all remaining space. How to set it to required height (row) and width (column)?
I just added an additional last row and set its size to Absolute and 0 pixel. This worked for me.
To complete the answer of @user232986 that helped me solve my issue.
This is code for VB.NET
In the designer I selected for
AutoSize
(Containing data like a Label for example)AutoSize
(Containing data like a Panel for example)Percent 100%
(This is the last row containing data)Absolute 0
(Add a dummy row)Then in my code I changed this settings and it worked like a charm.
Me.tableLay.AutoSizeMode = Windows.Forms.AutoSizeMode.GrowAndShrink
Me.tableLay.AutoSize = True
Me.tableLay.Dock = DockStyle.Fill
I only have a single column which is set to Percent 100,00%
.
You should add TableLayoutPanel
as tbl1 with two rows and two columns. Then set dock = fill autoscroll = true
and set width for 1st row to autosize
and for the second absolute 0.00 F
.
Do the same for column 1 and 2.
Now add actual TableLayoutPanel
in 1st rows 1st column.
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