ComponentOne FlexGrid for WinForms
Column Sizing
Using the C1FlexGrid Control > Rows and Columns > Column Sizing

The width of a column is determined by its Width property. At design time, the Width property can be set directly in the grid or through the C1FlexGrid Column Editor. In the grid, clicking and dragging the horizontal double arrow that appears at the right edge of a column's header allows the column to be resized.


The dotted vertical line indicates how the grid will be resized. Dragging the pointer to the left makes the column smaller; dragging it to the right makes the column larger. The column's Width property will be adjusted when the resize operation is complete.

In the C1FlexGrid Column Editor or in code, specify the value of the Width property for a column. For details on the C1FlexGrid Column Editor, see C1FlexGrid Column Editor. The following code sets the Width property of Column1 to 10:

To write code in Visual Basic

Visual Basic
Copy Code
_flex.Cols(1).Width = 10

To write code in C#

C#
Copy Code
_flex.Cols(1).Width = 10

To prevent resizing a specific column, set the AllowResizing property for the column to False either in the Column Tasks menu or C1FlexGrid Column Editor, or in code. For details on the Column Tasks menu, see Column Tasks Menu. The following code sets the AllowResizing property for Column1 to False:

To write code in Visual Basic

Visual Basic
Copy Code
_flex.Cols(1).AllowResizing = False

To write code in C#

C#
Copy Code
_flex.Cols(1).AllowResizing = False
See Also