在vsReport状态下,我想让满足条件的行变颜色if Item.Caption='aaaaa' then
  Sender.Canvas.Brush.Color:=clred;上面这个是父节点,但我的条件在子节点中,该怎么判断啊if ListView2.Items[0].SubItems.Strings[0]='bbbbb' then
Sender.Canvas.Brush.Color:=clred;
我用这条语句判断,但全部都变颜色了,但我只想让满足条件的一行变色。

解决方案 »

  1.   

    if ListView2.Items[0].SubItems.Strings[0]='bbbbb' then
    Sender.Canvas.Brush.Color:=clred;
    你循环的索引呢?如果if ListView2.Items[0].SubItems.Strings[0]='bbbbb' then成立当然全部变色了啊
      

  2.   

    ListView2.Items[0].SubItems[0] = 'bbbb'
      

  3.   

    用完了颜色记得要恢复原来的颜色,你恢复成原来的颜色的时候才能用原来的颜色继续画啊。
    color:TColor;
    beginif ListView2.Items[0].SubItems.Strings[0]='bbbbb' then
    begin
    color :=sender.canvas.brush.color;
    Sender.Canvas.Brush.Color:=clred;
    ...
    Sender.canvse.brush.color:=color;
    end;
    end;
      

  4.   

    谢谢楼上各位item 为 aaa
    sumitem 为 bbb
    我想让满足条件的那一行变颜色,只是改变这一行的颜色!
    item的我知道怎么弄
    但sunitem的不行
      

  5.   

    SubItems吧 ~  楼上的不是告诉你了吗