Visual Basic: MSFlexGrid/MSHFlexGrid Controls

CellBackColor, CellForeColor Properties

See Also    Example    Applies To

  • CellBackColor Returns or sets the background colors of individual cells or cell ranges.

  • CellForeColor Returns or sets the foreground colors of individual cells or cell ranges.

These properties are not available at design time.

Syntax

object.CellBackColor [=color]
object.CellForeColor [=color]

Syntax for the CellBackColor and CellForeColor properties has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
color Integer (enumerated). A numeric expression that specifies the color for the current cell selection. Setting either of these properties to zero paints the cell using standard background and foreground colors.

Remarks

Changing this property affects the current cell or the current selection, depending on the setting of the FillStyle property.

Setting either of these properties to zero causes MSHFlexGrid to paint the cell using the standard background and foreground colors. If you want to set either of these properties to black, set them to one instead of zero.

To set the colors of various MSHFlexGrid elements, use the BackColorBkg, BackColorFixed, BackColorSel, ForeColorFixed, and ForeColorSel properties. To set all non-fixed cells to the same background color, use the BackColor property.