我正在使用 C# 和 .Net 4.0,并希望在不更改键盘布局的情况下为文本框设置不同的拼写检查语言。
通过阅读此处的精彩帖子,我发现可以更改 InputLanguage.CurrentInputLanguage 以更改我的文本框的拼写检查语言。但这有副作用,键盘布局/语言也发生了变化。但是我总是需要在不破坏用户键盘设置的情况下对我的文本框进行 EN SpellCheck。这种情况有什么办法吗?
提前感谢所有可以帮助我解决此案的提示。
最佳答案
我已经找到了,如何解决它。
您必须知道,我在 Winforms 项目中使用 WPF TextBox。这是一个示例代码:
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;
关于c# - 可以在不更改键盘语言的情况下为文本框设置拼写检查语言吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24736177/