InputLanguage il = GetDesiredInputLanguage("智能 ABC");
if (il == null)
{
InputLanguage.CurrentInputLanguage = InputLanguage.DefaultInputLanguage;
MessageBox.Show("未能找到");
}
textBox1.Focus();
InputLanguage.CurrentInputLanguage = il;
....
public static InputLanguage GetDesiredInputLanguage(string layoutName)
{
InputLanguageCollection ilc = InputLanguage.InstalledInputLanguages;
foreach (InputLanguage il in ilc)
{
if (il.LayoutName.IndexOf(layoutName) != -1)
return il;
}
return null;
}