简单 我要改变表格某一行的颜色 那位帮我([email protected]

解决方案 »

  1.   

    什么表格啊
    StringGrid还是listView啊...
      

  2.   

    我想是DBGRID:
    在它的OnGetCellParam事件处理为好!procedure TForm1.dbgListGetCellParams(Sender: TObject; Column: TColumnEh;
      AFont: TFont; var Background: TColor; State: TGridDrawState);
    begin if not (gdFixed in State) then
      begin
        if DataModule1.Query1.fieldbyname('余额')>0 then
                 Background := clGreen
          else
            Background:=clred;
        end;
      end;  
    end;
      

  3.   

    用OnCalcCellColors事件吧
    procedure Tform1.wwDBGrid1CalcCellColors(Sender: TObject; Field: TField;
      State: TGridDrawState; Highlight: Boolean; AFont: TFont; ABrush: TBrush);
    begin
      afont.Color:=clred;
    end;