VSFlexGrid Control > VSFlexGrid Properties, Events, and Methods > VSFlexGrid Properties > ColWidth Property |
Returns or sets the width of the specified column in twips.
[form!]VSFlexGrid.ColWidth(Col As Long)[ = value As Long ]
Use this property to set the width of a column at runtime. To set column widths at design time, use the FormatString property. To set width limits for all columns, use the ColWidthMin and ColWidthMax properties. To set column widths automatically, based on the contents of the control, use the AutoSize method.
If the Col parameter is -1, then the specified width is applied to all columns.
If set ColWidth to -1, the column width is reset to its default value, which depends on the size of the control's current font. If set ColWidth to zero, the column becomes invisible. If you want to hide a column, however, consider using the ColHidden property instead. This allows you to make the column visible again with the same width it had before it was hidden.
This example sets the width of the third column to 1 inch (1440 twips)
fg.ColWidth(2) = 1440
Long