这是我的程序。

procedure format_integer_field(Atable: TDataSet);
 var i: integer;
begin
 if Atable.Active then
 if Atable.FieldCount > 0 then
 with Atable do
 begin
  for i:= 0 to FieldCount-1 do
  if (Fields[i] is TIntegerField) then
  begin
   (Fields[i] as TIntegerField).DisplayFormat := '###,###';
   (Fields[i] as TIntegerField).EditFormat := '#';
  end
  else
   if (Fields[i] is TFloatField) then
  begin
   (Fields[i] as TFloatField).DisplayFormat := '###,###.##';
   (Fields[i] as TFloatField).EditFormat := '#.##';
  end;
 end;
end;

在输入“0.9”之类的数字并且结果为“.9”之前,此方法可以正常工作。
我怎么能有千位分隔符和浮点数前小于零小于“1”。

最佳答案

您需要的格式是###,##0.0#

07-24 09:45
查看更多