C
cnlmgsoft
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.listView1CustomDrawItem(Sender: TCustomListView; Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);begin if (Item.SubItems.Strings[1] = '小计') then begin listView1.Canvas.Brush.Color := RGB(255, 240, 210); listView1.Canvas.Font.Color := clRed; end else begin listView1.Canvas.Brush.Color := clWhite; listView1.Canvas.Font.Color := clBlack; end;end;procedure TForm1.listView1CustomDrawSubItem(Sender: TCustomListView; Item: TListItem; SubItem: Integer; State: TCustomDrawState; var DefaultDraw: Boolean);begin if SubItem = 2 then begin listView1.Canvas.Brush.Color := RGB(255, 240, 210); listView1.Canvas.Font.Color:= clRed; end else begin listView1.Canvas.Brush.Color := clWhite; listView1.Canvas.Font.Color := clBlack; end;end;以上的代码 CustomDrawItem 和 CustomDrawSubItem 过程,如果注释掉任意一个是可以改变 listview 行颜色 或者 列颜色的,但我想 同时 改变ListView的 行和列 的颜色,以上的过程就不好用了,怎么办啊?帮我改改代码好吗,谢谢啊!!!