procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
Renk:Tcolor;
Renk1:Tcolor;
begin
begin
if (dbgrid1.datasource.dataset.recno mod 2) =0
then DBGrid1.Canvas.Brush.Color := clBlue
else DBGrid1.Canvas.Brush.Color := clRed;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
Renk:=DbGrid1.Canvas.Brush.color;
If Column.fieldname='Continent' then
If (Column.Field.Asstring ='North America') then
Begin
Dbgrid1.Canvas.Brush.Color:=Clwhite;
Dbgrid1.DefaultDrawColumnCell(Rect,Datacol,column, state);
Dbgrid1.Canvas.Brush.Color:=Renk;
End;
end;
end.
örnek program ektedir
Linkback: https://www.buyuknet.com/delphi-dbgrid-renklendirme-t11295.0.html