How to: Customize the Spelling Options Dialog
- 2 minutes to read
The following example demonstrates how to customize the Spelling Options Dialog by doing the following.
- Handle the SpellChecker.OptionsFormShowing event. It is raised when the form is about to be shown.
- Retrieve the Spelling Options Dialog’s form from the SpellChecker.FormsManager collection.
- Modify the form’s Controls collection to hide default controls and/or to add custom one. To retrieve the desired default control, call the Find method.
private void spellChecker1_OptionsFormShowing(object sender, DevExpress.XtraSpellChecker.FormShowingEventArgs e)
{
var optionsForm = spellChecker1.FormsManager.OptionsForm;
// You can hide the 'Add' button
spellChecker1.FormsManager.SpellCheckForm.Controls["btnAdd"].Visible = false;
// Or suppress the entire panel
GroupControl grpEditCustomDic = optionsForm.Controls.Find("grpEditCustomDic", true)[0] as GroupControl;
grpEditCustomDic.Visible = false;
optionsForm.Controls.Find("grpInternationDocs", true)[0].Top = grpEditCustomDic.Top;
optionsForm.Controls.Find("xtraTabControl1", true)[0].Height -= grpEditCustomDic.Height;
optionsForm.Height -= grpEditCustomDic.Height;
}
The image below demonstrates a customized Spelling Options 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 Options dialog.
Element Caption | Control | Name |
---|---|---|
Spelling tab | XtraTabControl | xtraTabControl1 |
Spelling tab page | XtraTabPage | xtraTabPage1 |
Apply button | SimpleButton | btnApply |
Cancel button | SimpleButton | btnCancel |
OK button | SimpleButton | btnOK |
General Options group | GroupControl | grpGeneral |
Ignore E-mails check edit | CheckEdit | chkEmails |
Ignore Words With MiXeDcASe check edit | CheckEdit | chkMixedCase |
Ignore words with numbers check edit | CheckEdit | chkNumbers |
Ignore repeated words check edit | CheckEdit | chkRepeatedWords |
Ignore words in UPPERCASE check edit | CheckEdit | chkUpperCase |
Ignore Internet and file addresses check edit | CheckEdit | chkWebSites |
Edit Custom Dictionary group | GroupControl | grpEditCustomDic |
Add, change or remove words from your custom dictionary | Label | lblChange |
Edit button | SimpleButton | btnEditDictionary |
International Dictionaries group | GroupControl | grpInternationDocs |
Choose the dictionary to use when checking your spelling | Label | lblChooseDic |
Language | Label | lblLanguage |
Language combo box edit | ComboBoxEdit | cbLanguage |