我正在使用 c#.net3.5,我想将 currentculture 设置的小数分隔符从逗号更改为点,但同时我希望用户可以在 numericupdown 控件中使用逗号作为小数分隔符。所以我试图改变我的文化设置如下
CultureInfo newUIculture = new CultureInfo("tr-TR");
newUIculture.NumberFormat.CurrencyDecimalSeparator = ",";
newUIculture.NumberFormat.CurrencyGroupSeparator = ".";
newUIculture.NumberFormat.NumberDecimalSeparator = ",";
newUIculture.NumberFormat.NumberGroupSeparator = ".";
newUIculture.NumberFormat.PercentDecimalSeparator = ",";
newUIculture.NumberFormat.PercentGroupSeparator = ".";
//Application.CurrentUICulture = newUIculture;//this line giving error.
Thread.CurrentThread.CurrentUICulture = newUIculture;//this line doesn't work
CultureInfo newCulture = new CultureInfo("tr-TR");
newCulture.NumberFormat.CurrencyDecimalSeparator = ".";
newCulture.NumberFormat.CurrencyGroupSeparator = "";
newCulture.NumberFormat.NumberDecimalSeparator = ".";
newCulture.NumberFormat.NumberGroupSeparator = "";
newCulture.NumberFormat.PercentDecimalSeparator = ".";
newCulture.NumberFormat.PercentGroupSeparator = "";
Application.CurrentCulture = newCulture;//this one work fine
当前的文化设置工作正常,但 currentUIculture 设置在我分配参数时不起作用。如何使用我提供的参数配置这两个设置?