日期:2014-05-17 浏览次数:20897 次
System.Globalization.NumberFormatInfo nf = new System.Globalization.CultureInfo(System.Globalization.CultureInfo.CurrentCulture.Name).NumberFormat; nf.NumberDecimalDigits = 5; float f = 2332.11f; MessageBox.Show(f.ToString("f",nf)); //2332.11000
------解决方案--------------------
DisplayFormat = '{0:F}'
------解决方案--------------------
float f = 2332.11f; MessageBox.Show(f.ToString("#####0.##")); //2332.11000
------解决方案--------------------
格式字符串 输入 结果 "{0:C}" 12345.6789 $12,345.68 "{0:C}" -12345.6789 ($12,345.68) "{0:D}" 12345 12345 "{0:D8}" 12345 00012345 "{0:E}" 12345.6789 1234568E+004 "{0:E10}" 12345.6789 1.2345678900E+004 "{0:F}" 12345.6789 12345.68 "{0:F0}" 12345.6789 12346 "{0:G}" 12345.6789 12345.6789 "{0:G7}" 123456789 1.234568E8 "{0:N}" 12345.6789 12,345.68 "{0:N4}" 123456789 123,456,789.0000 "Total: {0:C}" 12345.6789 Total: $12345.68
------解决方案--------------------
DisplayFormat = '{0:G}'可以试试
------解决方案--------------------