CellBackColor

This property returns and sets the background colors of individual cells or ranges of cells.

Syntax

object.CellBackColor [= color]

Parameters

object
Object expression that evaluates to a Grid control.
color
Enumerated integer. A numeric expression that specifies the color for the current cell selection. Setting this property to 0 paints the cell using standard background and foreground colors.

Remarks

The CellBackColor property is unavailable at design time.

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

Setting this property to 0 causes the Grid control to paint the cell using the standard background and foreground colors. If you want to set this property to black, set it to one instead of 0.

When working with color, be aware how color appears when viewed on a grayscale device. The following table shows how the 16-color palette translates to four grays.

Color
Red
Green
Blue
Gray conversion
Black 0 0 0 Black
White 255 255 255 White
Dark gray 128 128 128 Dark gray
Light gray 192 192 192 Light gray
Dark red 128 0 0 Black
Red 255 0 0 Dark gray
Dark yellow 128 128 0 Dark gray
Yellow 255 255 0 Light gray
Dark green 0 128 0 Black
Green 0 255 0 Dark gray
Dark cyan 0 128 128 Dark gray
Cyan 0 255 255 Light gray
Dark blue 0 0 128 Black
Blue 0 0 255 Dark gray
Dark magenta 128 0 128 Dark gray
Magenta 255 0 255 Light gray