各位兄弟们,我现在要实现一个listbox中根据item的值来显示不同的颜色.根据item的值来判断颜色.请高手们指点一下.

解决方案 »

  1.   

    procedure TForm1.lvListCustomDrawItem(Sender: TCustomListView;
      Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
    begin
      if Item.SubItems[5]='退款'  then
        Sender.Canvas.Font.Color:=clRed
      else Sender.Canvas.Font.Color:=clBlack;
    end;
      

  2.   

    ListBox每行显示不同的文件颜色:   
        
      http://www.easthot.net/HotForum/Topic.asp?topic_id=341&forum_id=1&Topic_Title=ListBox%C3%BF%D0%D0%CF%D4%CA%BE%B2%BB%CD%AC%B5%C4%CE%C4%BC%FE%D1%D5%C9%AB&forum_title=Visual+Basic   
        
      去看看吧