procedure Tinfo.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
        if query1.FieldByName(’all’).asstring>40’ then
        begin
                dbgrid1.Canvas.Font.Color:=clred;
                dbgrid1.Canvas.Brush.color:=clyellow;
        end
        else
        begin
                dbgrid1.Canvas.Font.Color:=clblue;
                dbgrid1.Canvas.Brush.color:=clyellow;
                end;
 
        dbgrid1.DefaultDrawColumnCell(rect,datacol,column,state);
end;