|
An anonymous tipster writes in: Perhaps there are some developers who need to change the backcolor of a single cell of a WGrid. I have solved this problem with the DrawItem event of the grid:
DrawItem event of the grid
{
//this change the cell-backcolor
if( (event->itemID == wanted_row) && (event->itemData == wanted_column)
)
{
event->canvas->SetBrush( WColor( WColorGreen ) );
}
//this change the selection-color
if( event->state == WDrawItemSelected )
{
event->state = (WDrawItemState) 0;
event->canvas->SetBrush( WColor( WColorRed ) );
}
return FALSE;
}
If you want to change the color of a cell you have to call: grid->Update(TRUE);
Or for the version by Herbert Menke: WRect rect = grid->GetRectangle( row, col ); grid->Invalidate( rect, true );