如何改变listview一行的颜色

解决方案 »

  1.   

    procedure TMainForm.ListView1CustomDrawItem(Sender: TCustomListView; 
      Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean); 
    begin 
      if Item.Caption = 'aaa' then   //加上条件
        (Sender as TListView).Canvas.Font.Color := clMaroon 
      else  
        (Sender as TListView).Canvas.Font.Color := clRed; 
    end; 
      

  2.   

    楼上只适用用于Delphi6以上版 否则会内存泄露