procedure TForm1.GridDrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if odd(Grid.DataSource.DataSet.RecNo) then//奇偶行判断
begin
Grid.Canvas.Font.Color:=clblack;
Grid.Canvas.Brush.color:=clwhite;
end
else
begin
Grid.Canvas.Font.Color:=clblack;
Grid.Canvas.Brush.color:=clcream;
end;
if Grid.SelectedRows.CurrentRowSelected then//dgRowSelect和dgMultiSelect都为真时有效
begin
Grid.Canvas.Font.Size:=12;
Grid.Canvas.Font.Style:=[fsBold];
Grid.Canvas.Font.Color:=clwhite;
Grid.Canvas.Brush.color:=clNavy;
end;
Grid.DefaultDrawColumnCell(rect,datacol,column,state);
end;