Loading...
Loading...
Implement spell checking capabilities in Windows Forms applications using Syncfusion SpellCheckerAdv. Use this skill whenever the user needs to add spell checking to text controls, configure dictionaries, set up context menu suggestions, customize ignore options, or retrieve spelling suggestions. This skill covers attaching the control to RichTextBox/TextBox, managing multiple language dictionaries, enabling real-time context menus, and handling misspelled word suggestions.
npx skill4agent add syncfusion/winforms-ui-components-skills syncfusion-winforms-spell-checkerusing Syncfusion.Windows.Forms.Tools;
// 1. Create SpellCheckerAdv control
SpellCheckerAdv spellCheckerAdv = new SpellCheckerAdv();
// 2. Set dictionary path
spellCheckerAdv.DictionaryPath = "Syncfusion_en_us.dic";
// 3. Attach to RichTextBox and trigger spell check
RichTextBox richTextBox = new RichTextBox();
spellCheckerAdv.SpellCheck(new SpellCheckerAdvEditorWrapper(richTextBox));// Implement ISpellCheckerAdvEditorTools
class TextBoxSpellEditor : ISpellCheckerAdvEditorTools
{
private TextBoxBase textBox;
public TextBoxSpellEditor(Control control)
{
Control = control;
}
public Control Control
{
get { return textBox; }
set { textBox = value as TextBoxBase; }
}
public string Text
{
get { return textBox.Text; }
set { textBox.Text = value; }
}
public string CurrentWord { get; set; }
public void SelectText(int start, int length)
{
textBox.Select(start, length);
}
}
// Enable context menu spell checking
TextBoxSpellEditor editor = new TextBoxSpellEditor(richTextBox);
spellCheckerAdv.PerformSpellCheckUsingContextMenu(editor);private void buttonSpellCheck_Click(object sender, EventArgs e)
{
spellCheckerAdv.SpellCheck(new SpellCheckerAdvEditorWrapper(richTextBox));
}TextBoxSpellEditor editor = new TextBoxSpellEditor(richTextBox);
spellCheckerAdv.PerformSpellCheckUsingContextMenu(editor);SpellCheckerAdv spellChecker = new SpellCheckerAdv();
spellChecker.Dictionaries = new DictionaryCollection();
// Add English dictionary
spellChecker.Dictionaries.Add(new HunspellDictionary()
{
Culture = new CultureInfo("en-US"),
DictionaryPath = @"en-US.dic",
GrammarPath = @"en-US.aff"
});
// Add French dictionary
spellChecker.Dictionaries.Add(new HunspellDictionary()
{
Culture = new CultureInfo("fr-FR"),
DictionaryPath = @"fr-FR.dic",
GrammarPath = @"fr-FR.aff"
});
// Switch to French at runtime
spellChecker.Culture = new CultureInfo("fr-FR");| Element | Purpose | When to Use |
|---|---|---|
| Set built-in dictionary location | Simple English spell checking |
| Add custom dictionaries (Hunspell, Ispell, OpenOffice) | Multi-language support |
| Set active spell-check language | Language switching |
| Trigger spell-check dialog | User-initiated spell checking |
| Enable context menu suggestions | Real-time spell checking |
| Retrieve correction suggestions | Programmatic spell checking |
| Skip special content types | Customized spell checking |