Subject Re: Coloring Grids Cells
Author Carlos Daniel Amaral de Mendonca
No evento onDrawColumnCell você pode implementar um código similar a
este, onde "gdACE" é o nome do DBGRID!!

procedure TframeControleAcesso.gdACEDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
VAR
iC,iD : INTEGER;
begin
gdACE.CANVAS.FONT.NAME := 'ARIAL';
gdACE.CANVAS.FONT.SIZE := 9;
gdACE.CANVAS.TEXTHEIGHT('A');
//
iC := $00C4FFFF;
iD := $0088FFFF;
//
IF gdSelected in State THEN BEGIN
gdACE.CANVAS.BRUSH.COLOR := clSilver;
gdACE.CANVAS.FONT.COLOR := clBlack;
gdACE.CANVAS.FONT.STYLE := gdACE.CANVAS.FONT.STYLE + [fsBold];
END ELSE BEGIN
IF ODD(dmESHERIFF.setACE.RECNO) THEN
gdACE.CANVAS.BRUSH.COLOR := iC
ELSE
gdACE.CANVAS.BRUSH.COLOR := iD;
gdACE.CANVAS.FONT.COLOR := clBlack;
gdACE.CANVAS.FONT.STYLE := gdACE.CANVAS.FONT.STYLE -[fsBold];
END;
// Cores particulares
IF (COLUMN.FIELDNAME = 'AUTORIZADO') AND
(COLUMN.FIELD.ASSTRING = 'Não') THEN
gdACE.CANVAS.FONT.COLOR := clRed;
// fundo
gdACE.Canvas.FillRect(RECT);
// texto
gdACE.DEFAULTDRAWCOLUMNCELL(RECT, DATACOL, COLUMN, STATE);
end;