给你一段代码试试:
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
with dbgrid1 do
begin
if Datasource.dataset.Recno mod 2<>0 then
canvas.brush.color:=clwhite;
else canvas.brush.color:=clyellow;
if(state=[gdSelected,gdFocused])or(state=[gdSelected]) then
canvas.Brush.Color:=clBlue;
DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
end;