Back to Devexpress

How to: Customize the Spelling Options Dialog

windowsforms-5136-controls-and-libraries-spell-checker-examples-how-to-customize-the-spelling-options-dialog.md

latest4.0 KB
Original Source

How to: Customize the Spelling Options Dialog

  • Jan 13, 2020
  • 2 minutes to read

The following example demonstrates how to customize the Spelling Options Dialog by doing the following.

  1. Handle the SpellChecker.OptionsFormShowing event. It is raised when the form is about to be shown.
  2. Retrieve the Spelling Options Dialog’s form from the SpellChecker.FormsManager collection.
  3. 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.
csharp
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;

}
vb
Private Sub spellChecker1_OptionsFormShowing(ByVal sender As Object, ByVal e As DevExpress.XtraSpellChecker.FormShowingEventArgs) Handles spellChecker1.OptionsFormShowing
    Dim optionsForm = spellChecker1.FormsManager.OptionsForm
    ' You can hide the 'Add' button 
    spellChecker1.FormsManager.SpellCheckForm.Controls("btnAdd").Visible = False

    ' Or suppress the entire panel 
    Dim grpEditCustomDic As GroupControl = TryCast(optionsForm.Controls.Find("grpEditCustomDic", True)(0), 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

End Sub

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 CaptionControlName
Spelling tabXtraTabControlxtraTabControl1
Spelling tab pageXtraTabPagextraTabPage1
Apply buttonSimpleButtonbtnApply
Cancel buttonSimpleButtonbtnCancel
OK buttonSimpleButtonbtnOK
General Options groupGroupControlgrpGeneral
Ignore E-mails check editCheckEditchkEmails
Ignore Words With MiXeDcASe check editCheckEditchkMixedCase
Ignore words with numbers check editCheckEditchkNumbers
Ignore repeated words check editCheckEditchkRepeatedWords
Ignore words in UPPERCASE check editCheckEditchkUpperCase
Ignore Internet and file addresses check editCheckEditchkWebSites
Edit Custom Dictionary groupGroupControlgrpEditCustomDic
Add, change or remove words from your custom dictionaryLabellblChange
Edit buttonSimpleButtonbtnEditDictionary
International Dictionaries groupGroupControlgrpInternationDocs
Choose the dictionary to use when checking your spellingLabellblChooseDic
LanguageLabellblLanguage
Language combo box editComboBoxEditcbLanguage