Table of Contents

Property CheckSpelling

Namespace
Alternet.Editor.TextSource
Assembly
Alternet.Editor.v9.dll

CheckSpelling

Gets or sets a value indicating whether the document can check spelling for its content.

public virtual bool CheckSpelling { get; set; }

Property Value

bool

Examples

Here is how to use a CheckSpelling in the C# code:

using Alternet.Editor;
using Alternet.Editor.TextSource;

public partial class Form1 : Form
{
    private TextSource textSource;
    private void Form1_Load(object sender, EventArgs e)
    {
        var syntaxEdit = new SyntaxEdit(this.components);
        textSource = new TextSource(this.components);
        textSource.LoadFile("myfile.txt");
        textSource.CheckSpelling = true;
        syntaxEdit.Source = this.textSource;
        syntaxEdit.WordSpell += new WordSpellEvent(SyntaxEdit_WordSpell);
    }

    private void SyntaxEdit_WordSpell(object sender, WordSpellEventArgs e)
    {
        // sample event for checking spelling
        e.Correct = (syntaxEdit.Lexer == null) || !syntaxEdit.Lexer.Scheme.IsPlainText(e.ColorStyle.Data - 1);
    }
}

Here is how to use a CheckSpelling in the Visual Basic code:

Imports System
Imports Alternet.Editor
Imports Alternet.Editor.TextSource

Partial Public Class Form1
    Inherits Form

    Private textSource As TextSource

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim syntaxEdit = New SyntaxEdit(Me.components)
        textSource = New TextSource(Me.components)
        textSource.LoadFile("myfile.txt")
        textSource.CheckSpelling = True
        syntaxEdit.Source = Me.textSource
        AddHandler syntaxEdit1.WordSpell, AddressOf SyntaxEdit_WordSpell
        syntaxEdit.WordSpell += New WordSpellEvent(AddressOf SyntaxEdit_WordSpell)
    End Sub

    Private Sub SyntaxEdit_WordSpell(ByVal sender As Object, ByVal e As WordSpellEventArgs)
        e.Correct = (syntaxEdit.Lexer Is Nothing) OrElse Not syntaxEdit.Lexer.Scheme.IsPlainText(e.ColorStyle.Data - 1)
    End Sub
End Class

Remarks

Set CheckSpelling property to true to enable the spelling checking of the text.

To provide real-world spelling, you will need to implement check spelling logic using third-party dictionaries.