Overview

If you prefer the default US - English Language to be the Spell Checker's base language, then absolutely you do not need to worry about setting any Dictionary file or any special setup. This editor has US - English dictionary internally embedded and you are simply ready to go.

This editor offers 2 mode of spell checking.

Regular Dialog based spell checking.

dialog_based_spell_checker

Anytime, if you want to invoke the Dialog based spell checking from your code, simply follow this snippet :

winFormHtmlEditor1.ToolbarItemOverrider.OnCheckSpellingButtonClicked(sender, e);

Inline Spell Checking.

inline_spell_checker

You can enable Inline Spell Checking by setting the property SpellCheckOptions.FireInlineSpellCheckingOnKeyStroke or simply from Design Time Smart Tag as shown here:

fire_inline_spell_check_from_smart_tag

The editor offers a public method named ForceInlineSpellCheck(). This method will start a inline spell checking session in a background thread and update the editor's content by marking the misspelled words. A single session will check the whole document only once. As soon as you change the content, you would need to call this method again to run another spell check session. As these spell checking is performed in the background thread, your Form will not suffer from any blockage. Moreover, we implemented thread synchronization techniques so that, one call will not cause any problem if any previous call is in progress.

So, once you set the property "SpellCheckOptions.FireInlineSpellCheckingOnKeyStroke", the editor invokes the ForceInlineSpellCheck() method if the user types some specific keys (i.e. Enter Key, Space Key etc.). You can also control what keys should invoke the ForceInlineSpellCheck() method by setting the property "SpellCheckOptions.InlineSpellCheckerFiringKeyCodes". This property takes a comma separated value of ASCII code for the keys. By default, it is "32,190" - which is the Key Code for Decimal Point (Full Stop) and Space Key.

Now, you would be asking, how can you control the style of the misspelled words. For example, by default, the misspelled words are decorated with CSS (color:red;text-decoration:underline). But, if you want that, your misspelled word should have different marking, (i.e. yellow background, different color, etc..), then, you can easily change this CSS from Spell Checker Options.

misspelled_word_css

Once the inline spell checker started and marked some misspelled words, you can restore the original text formatting for all misspelled words by calling the method CleanUpInlineSpellCheckMarkers().

Showing a Curly Underline for misspelled words:

Yes, you would like to show a curly underline for your misspelled words same like MS Word. In order to do that, there is a property under SpellCheckOptions named CurlyUnderlineImageFilePath. You can set this property with a value indicating the full path of a curly underline image file path.

curly_underline_path

It is more practical that you would have your curly underline image in your Application's Start Up Path and set this property programmatically in your Form's Load Event as follows:

setting_underline_image

Once you do that, you will see the misspelled words are decorated by curly underline. If you set this CurlyUnderlineImageFilePath property, then, setting InlineSpellCheckMisSpelledWordCSS property wont have any effect.

curly_underline_in_effect

Event for Detecting SpellCheck Completed

Whenever Spell Checking is completed either from the Dialog or from Inline Checking, SpellCheckCompleted event is fired.

spell_check_completed_event

From this event argument, you can detect, if the SpellChecking was cancelled or not. Even though, SpellCheckCompleted event fires both for Dialog based checking and Inline Checking, this Cancel Event Arg property will make sense only for Dialog based checking scenario

spell Checl Cancelled Arg

Last updated on 28 May 2015, Thursday, 5:04:40 AM
If you have any questions or concerns about this tutorial, Please feel free to share your comment.