本文整理自网络,侵删。
//....某一行
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;
//..某一列、某一格
procedure TForm1.ListView1CustomDrawSubItem(Sender: TCustomListView;
Item: TListItem; SubItem: Integer; State: TCustomDrawState;
var DefaultDraw: Boolean);
begin
inherited;
with lv3.Canvas.Brush do begin
case SubItem of
3:begin
color:=clYellow;
end else begin
color:=clWhite;
end;
end;
end;
end;
相关阅读 >>
Delphi 多次改变 richedit.text部份文本的颜色后,出现所有字体都变色的的解决办法
Delphi用mapfileandchecksum 函数检测 exe 或 dll 是否被修改
Delphi xe5 android实现繁体字到简体字的转换函数
更多相关阅读请进入《Delphi》频道 >>