Z
zengyi
Unregistered / Unconfirmed
GUEST, unregistred user!
LISTVIEW某单元格变颜色
我想让某行的某一个列变颜色,我代码如下,但是不清楚怎么的,只能让某行变颜色
procedure TFrmMainServer.ListViewServerCustomDrawItem(
Sender: TCustomListView; Item: TListItem; State: TCustomDrawState;
var DefaultDraw: Boolean);
begin
if (Trim(Sender.Column[3].Caption)='列标志') Then
Begin
If (Item.SubItems.Strings[2]>=100 ) then
Sender.Canvas.Font.Color :=clYellow
Else
Sender.Canvas.Font.Color :=clBlack; //恢复原有色彩
End;
end;
我想让某行的某一个列变颜色,我代码如下,但是不清楚怎么的,只能让某行变颜色
procedure TFrmMainServer.ListViewServerCustomDrawItem(
Sender: TCustomListView; Item: TListItem; State: TCustomDrawState;
var DefaultDraw: Boolean);
begin
if (Trim(Sender.Column[3].Caption)='列标志') Then
Begin
If (Item.SubItems.Strings[2]>=100 ) then
Sender.Canvas.Font.Color :=clYellow
Else
Sender.Canvas.Font.Color :=clBlack; //恢复原有色彩
End;
end;