Help Center

BackColorSelproperty

Returns or sets the background color of the selected cells 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 BackColorSel () AS OLE_COLOR
PROPERTY BackColorSel (BYVAL clr AS OLE_COLOR)

Parameters

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

Description

Returns or sets the background color of the selected cells of the grid. This property applies to the entire control and determines the highlight color whenever a cell or range of cells is selected.

Remarks

Highlight Behavior: The color specified by BackColorSel is only visible when a cell is part of the current selection. If the control loses focus, the visibility of this highlight depends on the Highlight property setting: flexHighlightNever = 0, flexHighlightAlways = 1, flexHighlightWithFocus = 2.

While BackColorSel sets the color for the temporary selection highlight, CellBackColor is used to permanently change the background color of specific individual cells regardless of whether they are selected.

Unlike band-specific properties (e.g., BackColorBand), BackColorSel is a global property that affects all selected cells across all hierarchical levels.

It is critical to pair this with the ForeColorSel property to ensure that the text remains readable against the selection background.

Example

' Set the background of selected cells to a custom light blue grid.BackColorSel = BGR(173, 216, 230)

' Set the text of selected cells to black for contrast grid.ForeColorSel = vbBlack

Reference