procedure TForm1.ListView1AdvancedCustomDrawSubItem(
Sender: TCustomListView; Item: TListItem; SubItem: Integer;
State: TCustomDrawState; Stage: TCustomDrawStage;
var DefaultDraw: Boolean);
var
itemrect:TRect;
toverlay
begin
defaultdraw:=True;
if (subitem=1) and (cdsSelected in state) and (stage=cdPrePaint) then
begin
if Boolean(ListView_GetSubItemRect(sender.Handle,item.Index,subitem,LVIR_ICON,@itemrect)) then
begin
with listview1.Canvas do
begin
ImageList1.Draw(listview1.Canvas,itemRect.Left,itemRect.Top,0);
end;
end;
end;
end;
//我觉得只能用ownerdraw的方法
//可能用imagelist1的drawoverlay方法更好,我今天没时间研究