Devexpress DBGrid在D2009中 网格脚金额默认求和乱码问题

来源:互联网 发布:巨人网络ceo刘伟 编辑:程序博客网 时间:2024/05/19 10:53

修改cxDataUtils文件,DefaultCurrencyDisplayFormat函数的返回值string->AnsiString

 

  1. function DefaultCurrencyDisplayFormat: AnsiString;
  2. var
  3.   ACurrStr: AnsiString;
  4.   I: Integer;
  5.   C: Char;
  6. begin
  7.   if CurrencyDecimals > 0 then
  8.   begin
  9.     SetLength(Result, CurrencyDecimals);
  10.     FillChar(Result[1], Length(Result), '0');
  11.   end
  12.   else
  13.     Result := '';
  14.   Result := ',0.' + Result;
  15.   ACurrStr := '';
  16.   for I := 1 to Length(CurrencyString) do
  17.   begin
  18.     C := CurrencyString[I];
  19.     if dxCharInSet(C, [',''.']) then
  20.       ACurrStr := ACurrStr + '''' + C + ''''
  21.     else
  22.       ACurrStr := ACurrStr + C;
  23.   end;
  24.   if Length(ACurrStr) > 0 then
  25.     case CurrencyFormat of
  26.       0: Result := ACurrStr + Result; { '$1' }
  27.       1: Result := Result + ACurrStr; { '1$' }
  28.       2: Result := ACurrStr + ' ' + Result; { '$ 1' }
  29.       3: Result := Result + ' ' + ACurrStr; { '1 $' }
  30.     end;
  31. end;