In TableLayoutPanel, if Dock = Fill and AutoSize = true, the last column / row takes up all the remaining space

In TableLayoutPanel, if we set AutoSize = true and Dock = fill then the last column / row will occupy all the remaining space. How to set it to the desired height (row) and width (column)?

+6
winforms
source share
3 answers

You should add a TableLayoutPanel as tbl1 with two rows and two columns. Then set dock = fill autoscroll = true and set the width for the first line to autosize and for the second absolute 0.00 F

Do the same for columns 1 and 2. Now add the actual TableLayoutPanel to the 1st row of the 1st column.

+2
source share

I just added an extra last line and set its size to Absolute and 0 pixel. It worked for me.

+6
source share

Complete @ user232986's answer, which helped me solve my problem. This is the code for VB.NET in the designer that I chose for

  • Row1: AutoSize (Contains data, such as a shortcut)
  • Row2: AutoSize (Contains data, such as a panel)
  • Row3: Percent 100% (This is the last row containing the data)
  • Row4: Absolute 0 (Add dummy line)

Then in my code, I changed these settings and worked like a charm.

 Me.tableLay.AutoSizeMode = Windows.Forms.AutoSizeMode.GrowAndShrink Me.tableLay.AutoSize = True Me.tableLay.Dock = DockStyle.Fill 

I have only one column that is set to Percent 100,00% .

0
source share

All Articles