Delen via


How to: Edit Columns and Rows in a TableLayoutPanel Control

You can use the collection editor of the TableLayoutPanel control, called the Column and Row Styles dialog box, to edit the rows and columns of your controls.

Note

If you want a control to span multiple rows or columns, set the RowSpan and ColumnSpan properties on the control. For more information, see Walkthrough: Arranging Controls on Windows Forms Using a TableLayoutPanel.

If you want to align a control within a cell, or if you want a control to stretch within a cell, use the control's Anchor property. For more information, see Walkthrough: Arranging Controls on Windows Forms Using a TableLayoutPanel.

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To edit rows and columns

  1. Drag a TableLayoutPanel control from the Toolbox onto your form.

  2. Click the TableLayoutPanel control's smart tag glyph (Smart Tag Glyph) and select Edit Rows and Columns to open the Column and Row Styles dialog box. You can also right click on the TableLayoutPanel control and select Edit Rows and Columns from the shortcut menu.

  3. To add or remove columns, select Columns from the Member type drop-down list box.

  4. To add or remove rows, select Rows from the Member type drop-down list box.

  5. Click the Add button to add a row or column to the end of the Member list.

  6. Click the Insert button to add a row or column before the currently selected item in the list.

  7. If you are adding a row or column, select the Size Type for the new row or column. For more information, see SizeType.

  8. To remove a row or column, click the Remove button to delete the currently selected item in the Member list.

See Also

Reference

SizeType

Other Resources

TableLayoutPanel Control (Windows Forms)