delphi - How to OwnerDraw TListView Bitmaps with vsIcon Style? -
there examples in stackoverflow ownerdraw subitems in tlistview vsreport style not find example on how ownerdraw bitmaps in tlistview vsicon style?
my bitmaps stored in third-party list , resized 32x32. not want use imagelist because bitmaps available in third-party list. code shown below draws first icon ok, remaining items empty. should doing in other event has access trect?
procedure tform1.cxlistview1customdrawitem(sender: tcustomlistview; item: tlistitem; state: tcustomdrawstate; var defaultdraw: boolean); var ibitmap: tbitmap; irect: trect; begin { create tbitmap } ibitmap := tbitmap.create; ibitmap.width := 32; ibitmap.height := 32; if item.index <> -1 begin { copy bitmap list ibitmap } aieimagelist.image[item.index].copytotbitmap(ibitmap); { resample bitmap } ibitmap.ieresample(32, 32); {fix} irect := item.displayrect(drbounds); { draw bitmap } sender.canvas.draw(irect.left, irect.top, ibitmap); end; ibitmap.free; end;