ForeColorSelproperty
Returns or sets the foreground color of the selected cells.
Syntax
PROPERTY ForeColorSel () AS OLE_COLOR
PROPERTY ForeColorSel (BYVAL clr AS OLE_COLOR)
Parameters
| Name | Description | |
|---|---|---|
clr | An 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
- Documented in Windows/Windows GUI/MSHFlexGrid Class.md
- Topic: Microsoft Hierarchical Grid