简体   繁体   English

C#-在相同键盘布局的两个不同IME之间自动切换

[英]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.

相关问题 C#自动在不同的文本框中使用不同的键盘布局? - C# use different keyboard layout in different text boxes automatically? C# 在两个数字之间切换? - C# Switch Between Two Numbers? 在 C# 的语言中切换多种键盘类型 - Switch between multiple keyboard types within a language in C# 有没有一种方法可以在C#中已安装的Windows键盘布局之间进行切换? - Is there a way to switch between installed windows keyboard layouts in c#? 如何在Wndproc中专门在C#Winform中获取IME布局? - How to get the IME layout in C# Winform specially in Wndproc? 启用不同的方法,但使用相同的名称-C# - Switch on different methods but using the same name - C# 在C#中检查两个ArrayList之间的差异 - Check different between two ArrayList in C# C# 使用这两个开关操作有什么区别? - C# What's the difference between using these two switch operations? 使用C#程序区分具有相同内容但格式不同的两个文本文件 - Differentiating between two text files having same content but in different format, using a C# program 如何从2个不同的程序集加载相同的插件,并在两者之间序列化和反序列化类型? C#.net - How to load same plugins from 2 different assemblies, and serializing and deserializing types between the two? C# .net
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM