拼写检查和格式选项 [英] spell check and format options

查看:84
本文介绍了拼写检查和格式选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在winforms的文本框中添加一个拼写cheker 非常相似,就像我在这里写作一样,波浪红线出现在底部,表示拼写错误。

解决方案

你好glynnrex,


我担心没有属性可以在WinForms TextBox中添加拼写检查器。我认为您可以尝试将WPF TextBox托管到WinForms应用程序中。


最简单的方法是从工具箱中的WPF互操作性选项卡中拖动ElementHost。创建一个WPF TextBox,将SpellCheck.IsEnabled属性设置为true。然后设置ElementHost.Child属性。



然后在Form Load事件中使用以下代码:

 private void Form1_Load(object sender,EventArgs e)
{
System.Windows.Controls.TextBox tb = new System.Windows.Controls.TextBox();
tb.SpellCheck.IsEnabled = true;
this.elementHost1.Child = tb;
}




还提供了一个如何在Winform中托管WPF控件的文档:


演练:在Windows窗体中托管WPF复合控件


希望这有帮助!


最好的问候,


Stanly


i need to add a spell cheker in my textbox of winforms  exacrly similar like i am writting here and wavy red lines appears at bottom for incorrect spell.

解决方案

Hi glynnrex,

I'm afraid there is no properties to add a spell checker into WinForms TextBox. I think what you can try is to host a WPF TextBox into WinForms application.

The easiest way is to drag an ElementHost from the WPF Interoperability tab in the Toolbox. Create a WPF TextBox, set SpellCheck.IsEnabled property to true. And then set ElementHost.Child property.

Then use the following code in the Form Load event:

        private void Form1_Load(object sender, EventArgs e)
        {
            System.Windows.Controls.TextBox tb = new System.Windows.Controls.TextBox();
            tb.SpellCheck.IsEnabled = true;
            this.elementHost1.Child = tb;
        }  


And also provide you a document that how to host WPF controls in Winform:

Walkthrough: Hosting a WPF Composite Control in Windows Forms

Hope this helps!

Best Regards,

Stanly


这篇关于拼写检查和格式选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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