문제

국제화를 a로 설정하는 방법 DateTimepicker 또는 Calendar WinForm 욕망 문화가 PC에 설치된 것과 다른 경우 .NET 제어?

도움이 되었습니까?

해결책

문화를 바꾸는 것은 불가능한 것 같습니다. 이것 좀 봐 KB 기사.

다른 팁

이전 솔루션을 기반으로 더 나은 것은 다음과 같습니다.

dateTimePicker.Format = DateTimePickerFormat.Custom;
dateTimePicker.CustomFormat = Application.CurrentCulture.DateTimeFormat.ShortDatePattern;
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("fr");
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture;

DateTimePicker의 경우

dtp.Format = DateTimePickerFormat.Custom;
dtp.CustomFormat = "yyyy-MM-dd"; // or the format you prefer

우회가 있다고 생각합니다.

  1. 이벤트 핸들러 "valuechanged"설정
  2. 암호

    dateTimePicker.Format = DateTimePickerFormat.Custom;
    string[] formats = dateTimePicker.Value.GetDateTimeFormats(Application.CurrentCulture);
    dateTimePicker.CustomFormat = formats[0];
    
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top