文本框输入自动切换输入法问题

方法一:

private void textBox1_Enter(object sender, EventArgs e)

  {

  InputLanguage il = InputLanguage.InstalledInputLanguages[0];

  InputLanguage.CurrentInputLanguage = il;

  }

  private void textBox1_Leave(object sender, EventArgs e)

  {

  InputLanguage il = InputLanguage.InstalledInputLanguages[1];

  InputLanguage.CurrentInputLanguage = il;

  }

 

 方法二:

//获取计算机已安装输入法

string mm = "";

            foreach (InputLanguage l in InputLanguage.InstalledInputLanguages)

            {

                mm += "/" + l.LayoutName;

                          }

            textBox2.Text = mm;

 

 foreach (InputLanguage l in InputLanguage.InstalledInputLanguages)

            {

                  if (l.LayoutName.IndexOf("五笔") > -1)                InputLanguage.CurrentInputLanguage = l; 

            }

 

你可能感兴趣的:(输入法)