AutoCorrect
- 2 minutes to read
As you type, each typed character is examined by the AutoCorrect service. When you type a character that typically means you have finished typing a word, AutoCorrect compares the word (or more precisely the group of characters) against its list of entries. It the word matches an entry, AutoCorrect substitutes the replacement text for a word.
AutoCorrect considers various characters to mean you've finished typing a word. These characters are spaces, punctuation and carriage returns.
If AutoCorrect makes an unwanted correction when you are editing a document, you can undo it by pressing CTRL+Z.
RichEditControl provides you with several built-in autocorrect techniques, and also gives you an opportunity to construct a substitution table or handle a special event.
#Automatic Hyperlink Detection
When you type in a web address, a network path, or email addresses in your document, they will appear as hyperlinks. This option is controlled via the AutoCorrectOptions.DetectUrls property.
#Correct Two Initial Capitals
Automatically corrects capitalization errors. This option is controlled via the AutoCorrectOptions.CorrectTwoInitialCapitals property.
#Use SpellChecker Suggestions
Automatically detect and correct typos and misspelled words. RichEditControl should have the spell checker component specified by the RichEditControl.SpellChecker property. If the spell checker provides a single suggestion, this suggestion automatically substitutes the incorrect word. If there are more than one suggestion, no changes are made. This option is controlled via the AutoCorrectOptions.UseSpellCheckerSuggestions property.
#Automatic Correction Using Table Entries
Enables you to quickly insert symbols or any long piece of text, and even images, so you can implement your own text expander functionality.
To implement this feature, create a new AutoCorrectReplaceInfoCollection, fill it with AutoCorrectReplaceInfo entries and use the IAutoCorrectService.SetReplaceTable method to register this table for use with RichEditControl.
#Automatic Correction Using Custom Procedure
Enables you to quickly insert symbols or any long piece of text, and even images, so you can implement your own text expander functionality.
To implement this feature, handle the RichEditControl.AutoCorrect event to analyze the input and provide the object for replacement. The input text is available via the AutoCorrectInfo.Text property. You can expand, shrink and move the text sample. The AutoCorrectInfo provides the required methods, such as AutoCorrectInfo.IncrementStartPosition or AutoCorrectInfo.DecrementStartPosition. The object used to substitute the text input is assigned to the AutoCorrectInfo.ReplaceWith property. It can be a string or an image.