A table layout panel is a container control for laying out other controls in a grid structure. The table layout panel automatically positions child controls in a grid. The grid structure is maintained when the control is resized. The size of columns and rows is set either in absolute pixels or as a percentage of the table layout panels size. Only one child control can be placed in each cell of the grid, but controls can span multiple columns and/or rows.

Table layout panel example

Use the table layout panel to arrange controls in a grid.

Table layout panel control properties
Property Access Type Method Description
Cell Border Style Design-only TableLayoutPanelCellBorderStyle Sets the type of border applied to cells in the table. Available styles are: no border (None), a single line, black border (Single), a single-line sunken border (Inset), a double-line sunken border (InsetDouble), a single-line raised border (Outset), a double-line raised border (OutsetDouble), a single-line border containing a raised portion (OutsetPartial).
ColumnCount Design-only Integer Sets the number of columns in the table.
Columns Design-only TableLayoutColumnStyleCollection Column collection. Click the ellipsis (…) to set column widths
RowCount Design-only Integer Sets the number of rows in the table.
Rows Design-only TableLayoutRowStyleCollection Rows collection. Click the ellipsis (…) to set the row heights.
GrowStyle Design-only TableLayoutPanelGrowStyle Sets the behavior of the table when there aren’t enough cells for all the child controls. Available options are automatically create new rows (AddRows) or columns (AddColumns), or prevent the table getting too small to contain all the child controls (FixedSize).

The table layout panel control supports all the common control properties.

Positioning Controls in Table Cells

Use the Anchor property on to position controls placed into table cells as shown below.

Example table cell layouts

Set the alignment of controls in a table layout panel cells using the Anchor property.

Leave a Comment

Start typing and press Enter to search