Setting spellcheck language for textbox WITHOUT changing keyboard language possible?

天大地大妈咪最大 提交于 2019-12-10 23:29:04

问题


I am using C# & .Net 4.0 and want to set the a differnet spellcheck language for a textbox without changing the keyboard layout.

I found out by reading great postings here that it is possible to change InputLanguage.CurrentInputLanguage for changing the SpellCheck language of my textbox. But this has the sideeffect, that the keyboard layout/language was changed too. But I need always an EN SpellCheck for my textbox without crashing the users keyboard settings. Is there any way for this case?

Thanks in Advance for every hint that can help me to solve this case.


回答1:


I have found out, how to solve it.

You have to know, that I use the WPF TextBox in a Winforms project. Here is a sample code:

System.Windows.Forms.Integration.ElementHost elementHost1 = new System.Windows.Forms.Integration.ElementHost();
System.Windows.Controls.TextBox textBox = new System.Windows.Controls.TextBox();
textBox.Language = System.Windows.Markup.XmlLanguage.GetLanguage("en-GB");
textBox.SpellCheck.IsEnabled = true;
elementHost1.Child = textBox;


来源:https://stackoverflow.com/questions/24736177/setting-spellcheck-language-for-textbox-without-changing-keyboard-language-possi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!