Help Center

ForeColorHeaderproperty

Returns or sets the colors used to draw text on the header of the MSHFlexGrid.

Windowspropertydoc-orphan
No implementation located. This member is documented, but the source scan found no matching declaration. It is likely declared in a header this scan does not resolve, or provided by a macro.

Syntax

PROPERTY ForeColorHeader (BYVAL BandNumber AS LONG) AS OLE_COLOR
PROPERTY ForeColorHeader (BYVAL BandNumber AS LONG, BYVAL clr AS OLE_COLOR)
PROPERTY ForeColorHeader () AS OLE_COLOR
PROPERTY ForeColorHeader (BYVAL clr AS OLE_COLOR)

Parameters

NameDescription
BandNumberA zero‑based index identifying the band whose background color is being retrieved or modified. If the band number is omited, band 0 is assumed.
clrAn OLE_COLOR value, such as a Visual Basic constant (e.g. vbBlue), a hex code, or an RGB value.

Description

Returns or sets the text color for for the header cells within a specific hierarchical band.

Remarks

This is an array-based property, meaning you must specify which band index (level of data) you are targeting.

While ForeColorFixed sets the text color for all fixed headers globally, ForeColorHeader allows you to apply unique colors to the headers of different nested data levels.

Because MSHFlexGrid is often used for read-only hierarchical data displays, this property is primarily used to enhance the readability of different data levels. Developers typically match ForeColorHeader with a contrasting BackColorHeader for that same band index to ensure header labels remain legible.

Setting the property to 0 may result in the default system text color. To force an explicit black color, use the constant vbBlack or the literal value 1.

When updating multiple band-specific visual settings, it is best practice to set Redraw = False before starting and True afterward to ensure a smooth, flicker-free update on modern displays.

Example

' Set the parent band (Band 0) header text to white grid.ForeColorHeader(0) = vbWhite

' Set the first child band (Band 1) header text to a custom blue grid.ForeColorHeader(1) = BGR(0, 0, 255)

Reference