你在 
DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
  Field: TField; State: TGridDrawState);
对你要的字段进心控制即可
设置颜色可更改Canvas 的颜色即可

解决方案 »

  1.   

    双击Table1,点击右键,选择增加所有字段,将那个字段的Name属性设为TableNumber
    procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
      Field: TField; State: TGridDrawState);
    begin
      if Field.Name = 'TableNumber' then
        if Field.Value = 0 then
          DBGrid1.Canvas.Font.Color := clRed;
      DBGrid1.DefaultDrawDataCell(Rect, Field, State);
    end;
      

  2.   

    我想实现背景的红色不是font
    还有怎么不为0 ,也全部是红色呀
      

  3.   

    procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
      Field: TField; State: TGridDrawState);
    begin
      if Table1.FieldByName('area').AsInteger = 0 then
          DBGrid1.Canvas.Brush.Color := clRed;
      DBGrid1.DefaultDrawDataCell(Rect, Field, State);
    end;
      

  4.   

    你是响应哪个事件弹出窗口的?
    我想用一个查询或LOCATE,在找到QUERY时就弹出的话要好些