日期:2011-07-04  浏览次数:20399 次

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;
  }

  private void button1_Click(object sender, System.EventArgs e) {
   InputLanguage il = GetDesiredInputLanguage("智能陈桥输入平台  5.6");
   if (il == null) {
    InputLanguage.CurrentInputLanguage = InputLanguage.DefaultInputLanguage;
    MessageBox.Show("未能找到");
   }
   textBox1.Focus();
   InputLanguage.CurrentInputLanguage = il;
  }