更改DateTimePicker控件的语言

本文关键字:语言 控件 DateTimePicker 更改 | 更新日期: 2023-09-27 18:01:14

我想更改DateTimePicker控件的语言。为此,我更改了DateTimePicker控件的DropDown事件的区域语言,但它不影响DateTimePicker控件。代码为

private void dtpDate_DropDown(object sender, EventArgs e)
{
    System.Globalization.CultureInfo ci = new   System.Globalization.CultureInfo("fr-FR");
    System.Threading.Thread.CurrentThread.CurrentCulture = ci;
}

我也试过这个

dtpDate.Format = DateTimePickerFormat.Custom;
string[] formats = dtpDate.Value.GetDateTimeFormats(Application.CurrentCulture);
dtpDate.CustomFormat = formats[0]; 

但仍然存在问题:-(

更改DateTimePicker控件的语言

更改Thread:的Culture

 System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("xx-XX");
 System.Threading.Thread.CurrentThread.CurrentCulture = cultureInfo;
 System.Threading.Thread.CurrentThread.CurrentUICulture = cultureInfo;