AdvListView Alternating coloured rows

Hi,

I've put the following code in the AdvListView1CustomDrawItem event to draw alternating coloured rows.

const
  cStripe = $CCFFCC;
begin 
  if Odd(Item.Index) then begin
    // odd list items have green background
    AdvListView1.Canvas.Brush.Color := cStripe
  end else begin
    // even list items have window colour background
    AdvListView1.Canvas.Brush.Color := clWindow;
  end;
end;

OwnerDraw can be set to either true or false with no difference.

Is there anything else I need to do to get the alternating coloured lines drawn?

Thanks

Please use something like:


procedure TForm1.AdvListView1DrawItemProp(Sender: TObject; ItemIndex,
  SubitemIndex: Integer; AState: TOwnerDrawState; ABrush: TBrush; AFont: TFont;
  ItemText: string);
begin
  if odd(ItemIndex) then
    ABrush.Color := clInfoBk
  else
    ABrush.Color := clWhite;
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  AdvListView1.TestFill();
  AdvListView1.OwnerDraw := true;
end;