ListView的DrawSubItem时间添加边框,字体变粗问题

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;

上一篇:如何在Python中轻松使用CVS,JSON,XML


下一篇:CVS简单介绍