DBGrid zebrado no Delphi
Programe o evento OnDrawColumnCell do DBGrid como abaixo:
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin if State = [] then begin if Table1.RecNo mod 2 = 1 then DBGrid1.Canvas.Brush.Color := clAqua else DBGrid1.Canvas.Brush.Color := clWhite; end; DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State); end;
O objeto Table1 é da classe TTable, mas esta dica poderá ser usada com outros DataSet’s, tais como IBDataSet, ClientDataSet, etc.