Professional User Interface Suite, Copyright FOSS Software Inc. Help Published with Permission.

You should set these colors for each cell in a row. Here is an example of how you can achieve this by overriding two methods SetRowColorBack() and SetRowColorText() in a CExtReportGridWnd-derived class.

class CBaseReportGridWnd : public CExtReportGridWnd
{
public:
CBaseReportGridWnd();
virtual ~CBaseReportGridWnd();

. . .

void SetRowColorBack(
CExtReportGridItem * pRGI,
COLORREF clrBkColor = COLORREF( -1L ),
CExtGridCell::e_cell_state_t eCellState = CExtGridCell::__ECS_NORMAL
);
void SetRowColorText(
CExtReportGridItem * pRGI,
COLORREF clrTextColor = COLORREF( -1L ),
CExtGridCell::e_cell_state_t eCellState = CExtGridCell::__ECS_NORMAL
);

. . .

};
void CBaseReportGridWnd::SetRowColorBack(
CExtReportGridItem * pRGI,
COLORREF clrBkColor, // = COLORREF( -1L )
CExtGridCell::e_cell_state_t eCellState // = CExtGridCell::__ECS_NORMAL
)
{
ASSERT_VALID( this );
if( pRGI == NULL )
{
ASSERT( FALSE );
return;
}
ASSERT_VALID( pRGI );
for( POSITION pos = ReportColumnGetStartPosition(); pos != NULL; )
{
const CExtReportGridColumn * pRGC = ReportColumnGetNext( pos );
ASSERT_VALID( pRGC );

CExtGridCellEx * pCell =
STATIC_DOWNCAST(
CExtGridCellEx,
ReportItemGetCell(
pRGC,
pRGI,
RUNTIME_CLASS( CExtGridCellEx )
)
);
if( pCell != NULL )
{
ASSERT_VALID( pCell );
pCell->BackColorSet(
eCellState,
clrBkColor
);
}
}
}

void CBaseReportGridWnd::SetRowColorText(
CExtReportGridItem * pRGI,
COLORREF clrTextColor, // = COLORREF( -1L )
CExtGridCell::e_cell_state_t eCellState // = CExtGridCell::__ECS_NORMAL
)
{
ASSERT_VALID( this );
if( pRGI == NULL )
{
ASSERT( FALSE );
return;
}
ASSERT_VALID( pRGI );
for( POSITION pos = ReportColumnGetStartPosition(); pos != NULL; )
{
const CExtReportGridColumn * pRGC = ReportColumnGetNext( pos );
ASSERT_VALID( pRGC );

CExtGridCellEx * pCell =
STATIC_DOWNCAST(
CExtGridCellEx,
ReportItemGetCell(
pRGC,
pRGI,
RUNTIME_CLASS( CExtGridCellEx )
)
);
if( pCell != NULL )
{
ASSERT_VALID( pCell );
pCell->TextColorSet(
eCellState,
clrTextColor
);
}
}
}