简体   繁体   English

如何将拼写检查器添加到Richtext框中?

[英]How can I add a spellchecker to a Richtext box?

如何在我的应用程序中的RichTextBox中添加拼写检查器?

You can purchase a spell checker control, integrate the Microsoft Office Spell Checker, write your own (which isn't too hard, actually, once you get the Soundex function figured out), or get a good free one. 您可以购买拼写检查器控件,集成Microsoft Office拼写检查器,编写自己的拼写工具(实际上,一旦弄清Soundex函数,就不会太难了),或者获得一个不错的免费软件。 Here's a (relatively) good free one. 这是一个(相对)不错的免费游戏。

http://www.codeproject.com/KB/recipes/spellchecker_mg.aspx http://www.codeproject.com/KB/recipes/spellchecker_mg.aspx

For commercial products, I'd say to Google "Spell check WinForms" 对于商业产品,我会向Google说“拼写检查WinForms”

If you're interested in rolling your own, I wrote one for Asp.Net back when I was in my beginner phase, and even then it only took me about a week to research and then a day or so to code. 如果您有兴趣开发自己的产品,那么我在初学者阶段就为Asp.Net撰写了一篇文章,即使这样,我也只花了大约一周的时间进行研究,然后花了大约一天的时间进行编码。 It's a fun pet project. 这是一个有趣的宠物项目。 I'd start by looking at soundex functions and comparing soundex values for similarity. 我将从查看soundex函数并比较soundex值的相似性开始。

You start by comparing all of the words in the TextBox to a known dictionary, and using the soundex functions to come up with similar words. 首先,将TextBox中的所有单词与已知词典进行比较,然后使用soundex函数得出相似的单词。

From there, you can go on to creating a table for "popular replacements. (for example, you can track that the word "teh" was replaced by "the" n times and move the more popular replacements to the top of the list. 从那里开始,您可以继续创建“常用替换项”表。(例如,您可以跟踪单词“ teh”被替换为“ the” n次,然后将更受欢迎的替换项移到列表的顶部。

I found a better solution. 我找到了更好的解决方案。 Hunspell is the spellcheck library Mozilla and OpenOffice.org uses. Hunspell是Mozilla和OpenOffice.org使用的拼写检查库。 Its been ported to .NET as NHunspell , and is real easy to implement and has samples for you to use. 它已作为NHunspell移植到.NET,并且真正易于实现,并且具有供您使用的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM