小于1.0的数字字段的Delphi TFloatField.DisplayFormat [英] Delphi TFloatField.DisplayFormat for numeric fields less than 1.0

查看:1096
本文介绍了小于1.0的数字字段的Delphi TFloatField.DisplayFormat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的程序。

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。

This is work fine until a number like "0.9" has been entered and result will be ".9". How can I have thousand separator and zero before floating point that smaller than "1".

推荐答案

需要 ###,## 0.0#

这篇关于小于1.0的数字字段的Delphi TFloatField.DisplayFormat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆