想在Listview中添入不同的数据时分别用不同的颜色的字来表示,请高手指教。

解决方案 »

  1.   

    在ListView的OnCustomDrawItem事件中,改变Sender.Canvas.Font.Color就可以了。
      

  2.   

    procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView;
      Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
    var
      with ListView1.Canvas do
      begin
        if (你的条件) then
        begin
          Font.Style:=[fsBold];
          Font.Color:= clred; 
        end;  
      end;
    end;
      

  3.   

    少了一句
      DefaultDraw := True ;