Board index » delphi » ListView SubItem Color

ListView SubItem Color

I'm trying to make the text (SubItem 2) in a ListView - blue, but when I use
the following code...it'll make SubItem 2 and all other SubItems - blue.
How can I make just 1 item (SubItem 2) blue when using the following If
Statement?
OwnerDraw property is set to := False

procedure TfrmPort.lvwPortCustomDrawSubItem(Sender: TCustomListView;
  Item: TListItem; SubItem: Integer; State: TCustomDrawState;
  var DefaultDraw: Boolean);
begin
  if (strtofloat(Item.SubItems.Strings[1]) > 0) and (SubItem = 2) then
  ListView1.Canvas.Font.Color := clBlue;
end;

Thanks,
Fred

 

Re:ListView SubItem Color


Quote
In article <7to0ga$b...@forums.borland.com>, Fred wrote:
> procedure TfrmPort.lvwPortCustomDrawSubItem(Sender: TCustomListView;
>   Item: TListItem; SubItem: Integer; State: TCustomDrawState;
>   var DefaultDraw: Boolean);
> begin
>   if (strtofloat(Item.SubItems.Strings[1]) > 0) and (SubItem = 2) then
>   ListView1.Canvas.Font.Color := clBlue

    Else
    ListView1.Canvas.Font.Color := LIstView1.Font.Color;

Quote
> end;

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!

Other Threads