procedure TFrmrdp.ListView1AdvancedCustomDrawSubItem(Sender: TCustomListView; Item: TListItem; SubItem: integer; State: TCustomDrawState; Stage: TCustomDrawStage; var DefaultDraw: Boolean);
var
rect: TRect;
cvs: TCanvas;
begin
cvs := Sender.Canvas;
cvs.Brush.Style := bsClear; // 清空笔刷样式
if SubItem = 1 then
begin
try
ListView_GetSubItemRect(Sender.Handle, Item.Index, SubItem, LVIR_LABEL, @rect);
cvs.Brush.Style := bsClear; // 清空笔刷样式
cvs.FillRect(rect); //填充rect
cvs.Brush.Color := clred; //设置笔刷样式
cvs.FrameRect(rect); //填充rect边框
finally
cvs.Brush.Style := bsClear; // 清空笔刷样式
DefaultDraw := False;
end;
end;
end;