Revision: 60372
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 6, 2012 06:57 by Winkyboy
Initial Code
private void fixLanguage(string whichLanguage) { string useLanguage; switch (whichLanguage.ToLower() ) { case "chinese": useLanguage = "zh-CN"; break; default: useLanguage = "en-US"; break; } InputLanguage language = InputLanguage.CurrentInputLanguage; if (language.Culture.Name != useLanguage) { foreach (InputLanguage lang in InputLanguage.InstalledInputLanguages) { if (lang.Culture.Name == useLanguage) { InputLanguage.CurrentInputLanguage = lang; } System.Console.WriteLine(lang.Culture.Name); } } if (language.Culture.Name == useLanguage) this.ImeMode = System.Windows.Forms.ImeMode.On; }
Initial URL
Initial Description
Just a snippet I like; this can be called on GotFocus or LostFocus of a field, and it *attempts* to set the input language to the desired language.
Initial Title
setLanguage in WinForms
Initial Tags
forms
Initial Language
C#