Grid::CellBkColor

Description

Get or set the background color of a datasheet cell.

Requires Origin 8.5.0 or later.

Syntax

BOOL CellBkColor(DWORD& dwColor, int nRow, int nCol, BOOL bGet=TRUE, BOOL bLabels=FALSE)

Parameters

dwColor
[input|output] reference to the color value
nRow
[input] cell's row index
nCol
[input] cell's column index
bGet
[input] get or set the color value
bLabels
[input] include or skip labels in index values

Return

TRUE if success else FALSE.

Examples

EX1

void Grid_CellBkColor_ex1()
{
    // Active worksheet or matrixsheet
    Datasheet ml = Project.ActiveLayer();
 
    Grid grid;
    if( !grid.Attach(ml) )
        return;
 
    // Reverse the text color and backgroud color in the cell at row 2, column 2
    DWORD dwBkColor, dwTextColor;
    if( grid.CellBkColor(dwBkColor, 1, 1) &&
        grid.CellTextColor(dwTextColor, 1, 1) )
    {
        grid.CellBkColor(dwTextColor, 1, 1, FALSE);
        grid.CellTextColor(dwBkColor, 1, 1, FALSE);
    }
}

Remark

See Also

Grid::CellTextColor

header to Include

origin.h