我用DBGrid做一个入库单,一但发现入库数量小于0,则该入库数字体为红色我现在只能改变某一行字体的颜色可到某一个单元格就始终不行,我的代码是:
procedure TInv_InxDepot.Inv_BillP1dgBillDrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);
begin
   //if Column.FieldName='Quantity' then
   if AQBill.FieldByName('Quantity').AsInteger<0 then      DBGrid1.Canvas.Font.Color:=clred;
 
   DBGrid1.DefaultDrawColumnCell(Rect,datacol,column,state);end;