VSFlexGrid Control > VSFlexGrid Properties, Events, and Methods > VSFlexGrid Methods > AutoSize Method |
Resizes column widths or row heights to fit cell contents.
[form!]VSFlexGrid.AutoSize Col1 As Long, [ Col2 As Long ], [ Equal As Boolean ], [ ExtraSpace As Single ]
The parameters for the AutoSize method are described below:
Col1 As Long, Col2 As Long
Specify the first and last columns to be resized so their widths fit the widest entry in each column. The valid range for these parameters is between 0 and Cols -1. Col2 is optional. If it is omitted, only Col1 is resized.
Equal As Boolean (optional)
If True, all columns between Col1 and Col2 are set to the same width. If False, then each column is resized independently. This parameter is optional and defaults to False.
ExtraSpace As Single (optional)
Allows you to specify extra spacing, in twips, to be added in addition to the minimum required to fit the widest entry. This is often useful if you wish to leave extra room for pictures or margins within cells. This parameter is optional and defaults to zero.
The AutoSize method may also be used to resize row heights. This is useful when text is allowed to wrap within cells (see the WordWrap property) or when cells have fonts of different sizes (see the Cell property).
The AutoSizeMode property determines whether AutoSize will adjust column widths or row heights.