TableLayoutPanel::SetColumn Method (Control^, Int32)
Sets the column position of the specified child control.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Parameters
- control
-
Type:
System.Windows.Forms::Control^
The control to move to another column.
- column
-
Type:
System::Int32
The column to which control will be moved.
The SetColumn method moves the control to another column in the TableLayoutPanel. The columns and rows have zero-based indexes. Setting the column position to -1 specifies that the control will flow to the first empty cell.
This method reapplies the table layout to all controls in the TableLayoutPanel.
This method is called by the Column property, which the panel adds to its child controls at design time.
The following code example uses the SetColumn method to swap two controls contained within a TableLayoutPanel control. The example assumes a TableLayoutPanel control with at least two rows.
Available since 2.0