How To: Customize the Spelling Dialog
- 2 minutes to read
This example demonstrates how to customize the spell checker’s Spelling Dialog.
You can modify layouts of both Outlook-inspired and Word-inspired Spelling Dialogs by doing the following.
- Handle the SpellChecker.SpellingFormShowing event. It is raised when the form is about to be shown.
- Retrieve the Spelling Dialog’s form from the SpellChecker.FormsManager collection.
- Modify the form’s Controls collection to hide default buttons and/or to add custom control.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-customize-the-spelling-and-spelling-options-dialogs-t422124
private void spellChecker1_SpellingFormShowing(object sender, DevExpress.XtraSpellChecker.SpellingFormShowingEventArgs e)
{
var spellDialogForm = spellChecker1.FormsManager.SpellCheckForm;
spellDialogForm.Controls["btnIgnore"].Enabled = false;
spellDialogForm.Controls["btnIgnoreAll"].Visible = false;
spellDialogForm.Controls["btnChangeAll"].Visible = false;
spellDialogForm.Controls.Add(new SimpleButton() { Text = "Custom Button", Size = new Size(100, 25), Location = new Point(10, 150) });
}
The following image illustrates a customized Spelling Dialog.
Table of Controls
The code sample above utilizes default control names to access them. The following table gives names for all of these default controls, owned by a spelling dialog.
Element Caption | Control | Element Name |
---|---|---|
Add to Dictionary (Add) button | SimpleButton | btnAdd |
Cancel button | SimpleButton | btnCancel |
Change button | SimpleButton | btnChange |
Change All button | SimpleButton | btnChangeAll |
Close button | SimpleButton | btnClose |
Ignore Once (Ignore) button | SimpleButton | btnIgnore |
Ignore All button | SimpleButton | btnIgnoreAll |
Undo Last button | SimpleButton | btnUndoLast |
Not In Dictionary label | LabelEdit | lblNotInDictionary |
Suggestions label | LabelEdit | lblSuggestions |
Repeated Word label | LabelEdit | lblRepeatedWord |
Delete button | SimpleButton | btnDelete |
Not in Dictionary memo edit (Word-type form) | CustomSpellCheckMemoEdit | mmNotInDictionary |
Suggestions list box | ListBoxControl | lbcSuggestions |
Options button | SimpleButton | btnOptions |
Not in Dictionary text edit (Outlook-type form) | TextEdit | txtNotInDictionary |
Change to: text edit (Outlook-type form) | TextEdit | txtChangeTo |