这一段怎么样?
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect:TRect;DataCol: Integer; Column: TColumn; State: TGridDrawState);beginif Table1.FieldByName('成绩').AsInteger<60 thenDBGrid1.Canvas.Font.Color := clRed;DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);end;

解决方案 »

  1.   

    这是我原来程序中的一段,你自己体会并稍做改动就行。
    procedure TXT_XinXi_Form.WuZiDBGridDrawColumnCell(Sender: TObject;
      const Rect: TRect; DataCol: Integer; Column: TColumn;
      State: TGridDrawState);
    begin
      if column.Grid.Fields[X].Value < 60 then
        wuzidbgrid.Canvas.Font.Color := clred;
      wuzidbgrid.DefaultDrawColumnCell(rect, datacol, column, state);
    end;
      

  2.   

    去去去,为什么要那么累,一个RXLIB或EHLIB的DBGRID都可以搞定,
    他们都有OnGetCellParam,在其中判断就行了,非常方便,痛快。在那过程中
    可以设字体,颜色,什么都行。
    去康炜那儿下一个吧。EHLIB是最好的DBGRID控件。
    http://www.jd365.net/kangwei/
    user:cch_b
    pass:dcvvcd
      

  3.   

    去去去,为什么要那么累,一个RXLIB或EHLIB的DBGRID都可以搞定,
    他们都有OnGetCellParam,在其中判断就行了,非常方便,痛快。在那过程中
    可以设字体,颜色,什么都行。
    去康炜那儿下一个吧。EHLIB是最好的DBGRID控件。
    http://www.jd365.net/kangwei/
    user:cch_b
    pass:dcvvcd