Compartir a través de


AutoSize Behavior in the TableLayoutPanel Control

Distinct AutoSize Behaviors

The TableLayoutPanel control supports automatic sizing behavior in the following ways:

  • Through the AutoSize property;

  • Through the SizeType property on the TableLayoutPanel control’s column and row styles.

The AutoSize Property with Row and Column Styles

The following table describes the interaction between the AutoSize property and the TableLayoutPanel control’s column and row styles.

AutoSize setting Style interaction

false

The TableLayoutPanel control proceeds from left to right, and allocates space for the column or row or in the following order.

  1. If the SizeType property is set to Absolute, the number of pixels specified by Width or Height is allocated.

  2. If the SizeType property is set to AutoSize, the number of pixels returned by the child control’s GetPreferredSize method is allocated.

  3. After space for all Absolute and AutoSize columns or rows is allocated, any columns or rows with SizeType set to Percent are used to proportionally allocate the remaining free space

true

Similar to the previous interaction, with the exception that Percent columns or rows acquire an automatic sizing aspect.

The TableLayoutPanel control expands the column or row to create adequate free space, so that no column or row with Percent styling clips its contents. The TableLayoutPanel control allocates the new space proportionally according to the Width or Height property.

See Also

Reference

TableLayoutPanel Control Overview
TableLayoutPanel