procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
with ListView1.Canvas.Brush do
begin
case Item.Index of
0: Color := clYellow;
1: Color := clGreen;
2: Color := clRed;
end;
end;
end;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
with ListView1.Canvas.Brush do
begin
case Item.Index of
0: Color := clYellow;
1: Color := clGreen;
2: Color := clRed;
end;
end;
end;
ListView1自定义绘制项代码示例
博客给出了一段代码,是关于ListView1自定义绘制项的过程。代码中通过ListView1.Canvas.Brush根据Item.Index设置不同颜色,如索引为0时设为黄色,1时设为绿色,2时设为红色。
4126

被折叠的 条评论
为什么被折叠?



