FontWidthHeaderproperty
Returns or sets the width, in points, of the font to be used for text displayed withinthe grid's header area.
Syntax
PROPERTY FontWidthHeader (BYVAL BandNumber AS LONG) AS SINGLE
PROPERTY FontWidthHeader (BYVAL BandNumber AS LONG, BYVAL nWidth AS SINGLE)
Parameters
| Name | Description | |
|---|---|---|
BandNumber | The index of the hierarchical band (starting at 0 for the top level). | |
nWidth | The width of the font, in points. A value of 0 typically resets the font to its standard natural width for the current point size. |
Description
Returns or sets the width of the font used in the column headers for a specific hierarchical band.
Remarks
This property is only functional when the grid is bound to a Hierarchical Recordset (using the ADO SHAPE command). In unbound mode, only Band 0 is typically available.
In modern maintenance of legacy apps, this property is often used to horizontally compress long header text into narrow columns without reducing the font's vertical height.
Changing the FontWidthHeader does not automatically resize the column. If you increase the font width, you must manually adjust the ColWidth for that band to prevent text clipping.
Example
' Standard header font for the main band grid.FontWidthHeader(0) = 0
' Squeeze child headers in Band 1 to fit smaller columns grid.FontWidthHeader(1) = 6
Reference
- Documented in Windows/Windows GUI/MSHFlexGrid Class.md
- Topic: Microsoft Hierarchical Grid