Help Center

ForeColorSelproperty

Returns or sets the foreground color of the selected cells.

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 ForeColorSel () AS OLE_COLOR
PROPERTY ForeColorSel (BYVAL clr AS OLE_COLOR)

Parameters

NameDescription
clrAn OLE_COLOR value, such as a Visual Basic constant (e.g. vbWhite), a system constant (e.g. vbHighlightText), a hex code, or an RGB value.

Description

Returns or sets the text color for all fixed cells in the control. Fixed cells are non-scrolling areas typically used for data labels or column headers.

Remarks

ForeColorSel works in tandem with BackColorSel to ensure that selected text remains readable against the highlight background. To maintain readability, ensure there is high contrast between the selection background and the text color (e.g., white text on a dark blue background).

Unlike band-specific properties, this applies to all selected cells regardless of which hierarchical level (band) they belong to.

The selected color is only visible if the selection is active. To ensure selection colors are always visible even when the control loses focus, set the Highlight property to flexHighlightAlways.

Example

' Set the background of selected cells to dark blue grid.BackColorSel = BGR(0, 0, 128)

' Set the text of selected cells to white for clarity grid.ForeColorSel = vbWhite

Reference