TDBAdvGrid Alternate Row Coloring

I have always used something like the below to alternate row coloring with my TCRDBGrid but the TDBAdvGrid has no DefaultDrawColumnCell, how else could I accomplish the same? I read your Developers Guide but it seems to only touch on all of the amazing amount of options that are available. Is there more detailed information available?



procedure TMainForm.MyGridDrawColumnCell(Sender: TObject;

const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);

var

Grid : TCRDBGrid;

Row : integer;

begin

Grid := sender as TCRDBGrid;

Row := Grid.DataSource.DataSet.RecNo;

if not ((gdFocused in State) or (gdSelected in State)) then

    begin

      if Odd(Row) then

        Grid.Canvas.Brush.Color := OddRowColor

      else

        Grid.Canvas.Brush.Color := EvenRowColor;

    end

else

    begin

      Grid.Canvas.Brush.Color := AdvNavBar.HoverTabColorTo;

    end;

Grid.DefaultDrawColumnCell(Rect, DataCol, Column, State);

end;

You can use banding. Make sure for columns where you want to see banding to set ShowBands = true

under grid.Columns[index]

 

Example:

 

procedure TForm1.FormCreate(Sender: TObject);

begin

  dbadvgrid1.Bands.Active := true;

  dbadvgrid1.Bands.PrimaryColor := clgreen;

  dbadvgrid1.Bands.SecondaryColor := clred;

  dbadvgrid1.Columns[1].ShowBands := true;

  dbadvgrid1.Columns[3].ShowBands := true;

end;

OK, Thanks!



Since I wanted the entire row I did



for I := 1 to ClientsGrid.ColCount-1 do

   begin

     if Odd(ClientsGrid.Row) then

       ClientsGrid.Columns.ShowBands := True

     else

       ClientsGrid.Columns.ShowBands := False;

   end;