procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
var
R: TRect;
begin
with Sender.Canvas do begin
R := Item.DisplayRect(drBounds);
if Item.Index mod 2 = 1 then begin//对奇数行改变底色和字体
Brush.Color := clTeal;
Font.Color := clYellow;
Font.Style := Font.Style + [fsBold];
DefaultDraw := False;
end;
if cdsSelected in State then begin
Brush.Color := clHighLight;
Font.Color := clHighLightText;
end;
FillRect(R);
TextRect(R, R.Left + 2, R.Top, Item.Caption);
end;
DefaultDraw := False;
end;