procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
var
aRect: TRect;
bmp: TBitmap;
begin
aRect := Item.DisplayRect(drBounds);
if cdsSelected in State then
begin
//cdsFocused 还可以分别处理是激活状态时的图象
DefaultDraw := False; //加上这一句就可以了
bmp := TBitmap.Create;
try
ImageList1.GetBitmap(0, bmp);
Sender.Canvas.StretchDraw(Rect(aRect.Left, aRect.Top, bmp.Width, bmp.Height), bmp);
finally
bmp.Free;
end;
end;
end;
//这个效果不知道是不是你要的! 去掉哪个覆盖上一层蒙蒙的蓝色