Breyta

Deila með


TableLayoutPanel.ColumnCount Property

Definition

Gets or sets the maximum number of columns allowed in the table.

public:
 property int ColumnCount { int get(); void set(int value); };
public int ColumnCount { get; set; }
member this.ColumnCount : int with get, set
Public Property ColumnCount As Integer

Property Value

The maximum number of columns in the TableLayoutPanel control. The default is 0.

Remarks

Setting the ColumnCount property does not create columns or allocate any backing memory. Memory allocation occurs when the columns are created, so you can set this property to MaxValue.

Setting this property causes the table to undergo another layout operation.

You can specify both the ColumnCount and the RowCount properties for layouts with a known and fixed number of cells. You can also specify one property or the other if you expect the number of cells in your layout to grow, assuming that the GrowStyle property allows for such growth. If the value of RowCount is 0, the panel will grow by adding rows, and if the value of ColumnCount is 0, the panel will grow by adding columns. Specifying panel growth with the GrowStyle property is preferred to setting RowCount or ColumnCount to 0, however.

Controls can be added or deleted from the table using the Controls property.

Applies to

See also