它自己有个重绘事件onDrawDataCell
procedure TForm1.DBGrid2DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
begin
if uppercase(Field.FieldName)='字段名' then
begin
DBGrid2.Canvas.FillRect(Rect);
if ADOTable1.Fieldbyname('字段名' ).value<0 then
DBGrid2.Canvas.TextOut(Rect.left+2,Rect.top+2,'0 ');
end;
end;
很多方法呀
确定太多就用for循环吧
for i:=... to ... do
begin
if(DBGrid.columns.items[i].Field.asinteger<0)then
DBGrid.columss.items[i].field.asinteger:=0;
end;
...自已填上初值终值,不连续的就分开来判断。