开发者

How can I add a spellchecker to a Richtext box?

How can 开发者_如何转开发I add a spellchecker to a richtextbox in my application?


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. Here's a (relatively) good free one.

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

For commercial products, I'd say to Google "Spell check 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. It's a fun pet project. I'd start by looking at soundex functions and comparing soundex values for similarity.

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.

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.


I found a better solution. Hunspell is the spellcheck library Mozilla and OpenOffice.org uses. Its been ported to .NET as NHunspell, and is real easy to implement and has samples for you to use.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜