I want to change the color of selected records (marked check boxes) and focused record in a TcxGrid by different colors.
You can do this using the code below:
procedure TMyForm.cxGrid1DBTableView1CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
begin
if AViewInfo.GridRecord.Focused then
ACanvas.Brush.Color := clBlue;
if AViewInfo.GridRecord.Selected then
ACanvas.Brush.Color := clGreen;
end;
if you want to change the color of just cell instead of the whole row, you can do it by removing .GridRecord expression after AviewInfo.