[英]C# - Automatically switch between two different IME in the same keyboard layout
I did an application to enter chinese pinyin and hanzi in a database. 我做了一个应用程序,以在数据库中输入中文拼音和汉字。 That means that the operator have to switch constantly between "Pinyinput" and "sogou input" with ctrl+shift There is a way to make the IME change automaticall when a textbox is selected? 这意味着操作员必须通过ctrl + shift在“ Pinyinput”和“ sogou input”之间不断切换。有一种方法可以使IME在选择文本框时自动全部更改? I mean, not switch the keyboard layout, just the input method of the same keyboard layout 我的意思是,不切换键盘布局,而只是切换相同键盘布局的输入法
try this, I'm not sure about the name of the languages, try to debug it and get the right name if it didn't work. 试试看,我不确定语言的名称,尝试调试它,如果没有用,请获取正确的名称。
public void ToPinyinput()
{
string CName= "";
foreach(InputLanguage lang in InputLanguage.InstalledInputLanguages)
{
CName = lang.Culture.EnglishName.ToString();
if(CName.StartsWith("Pinyinput"))
{
InputLanguage.CurrentInputLanguage = lang;
}
}
}
public void Tosogou()
{
string CName= "";
foreach(InputLanguage lang in InputLanguage.InstalledInputLanguages)
{
CName = lang.Culture.EnglishName.ToString();
if(CName.StartsWith("sogou"))
{
InputLanguage.CurrentInputLanguage = lang;
}
}
}
if it didn't work, you need to change the following line to the correct lang name: 如果不起作用,则需要将以下行更改为正确的语言名称:
CName.StartsWith("langName")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.