如何实现当某textBox控件成为焦点时,自动打开搜狗输入法;失去焦点时,恢复原有输入法
今晚测试的结果,如下:
private InputLanguage ThisFormDefaultInputLanguage = InputLanguage.DefaultInputLanguage; private void txtContent_Enter(object sender, EventArgs e) { InputLanguageCollection ilc = InputLanguage.InstalledInputLanguages; foreach(InputLanguage il in ilc) { if(il.LayoutName.Contains("搜狗")) InputLanguage.CurrentInputLanguage = il; } foreach(InputLanguage il in ilc) { if(il.LayoutName.Contains("中文")) InputLanguage.CurrentInputLanguage = il; } } private void txtContent_Leave(object sender, EventArgs e) { InputLanguage.CurrentInputLanguage = ThisFormDefaultInputLanguage; }