C#-在相同键盘布局的两个不同IME之间自动切换 [英] C# - Automatically switch between two different IME in the same keyboard layout

查看:136
本文介绍了C#-在相同键盘布局的两个不同IME之间自动切换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一个应用程序,在数据库中输入中文拼音和汉字。
这意味着操作员必须通过ctrl + shift
在 Pinyinput和 sogou input之间不断切换。有一种方法可以使IME在选择文本框时自动全部更改?
我的意思是,不是切换键盘布局,而是切换相同键盘布局的输入方法

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

        }

无效,您需要将以下行更改为正确的lang名称:

if it didn't work, you need to change the following line to the correct lang name:

CName.StartsWith("langName")

这篇关于C#-在相同键盘布局的两个不同IME之间自动切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆