ListView & TreeView 的绘制:
procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
var
p:trect;
begin
if cdsselected in state then
begin
listview1.Canvas.Font.Color:=clgreen;
listview1.Canvas.brush.Color:=clred;
p:=item.displayrect(drselectbounds);
listview1.Canvas.FillRect(p);
listview1.Canvas.Textout(p.Left+2,p.Top,item.Caption);
listview1.Canvas.brush.Color:=clblue;
listview1.Canvas.FrameRect(item.displayrect(drselectbounds));
defaultdraw:=false;
end;
end;