Skip to content

Add a spell checker to your C# applications

Add a spell checker to your C# applications using Sentry’s spellchecker

Steps once you get the download the eval:

  • copy DLL (C:Program Filesssceruntimessce5532.dll) and C:Program Filesssceruntimelex folder to target dir
  • add: “using Sentry;” to any classes using the spell checker
  • set the eval key: SpellingCheckerEngine.SetKey(<eval key from email>);
  • set lex path: SpellingCheckerEngine.SetMainLexPath(<target dir> + “\lex”);
  • set lext files: SpellingCheckerEngine.SetMainLexFiles(“ssceam.tlx,ssceam2.clx”);

Add option and color setting vars (based on the C# sample code project) and event handlers to the RichTextBox (named rtbText here)…

[sourcecode language=”c#”]

private uint RTB1Options = (uint)SpellingCheckerEngine.backgroundOptions.MARK_COLOR;
private System.Drawing.Color RTB1MarkColor = System.Drawing.Color.Red;

private uint RTB2Options = (uint)SpellingCheckerEngine.backgroundOptions.MARK_STRIKETHROUGH;
private System.Drawing.Color RTB2MarkColor = System.Drawing.Color.Transparent;

private void rtbText_Enter(object sender, EventArgs e)
{
SpellingCheckerEngine.CheckCtrlBackgroundNotify(rtbText.Handle,
RTB1Options, RTB1MarkColor);
}

private void rtbText_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
// Mouse was right-clicked. Present the spelling context menu.
SpellingCheckerEngine.CheckCtrlBackgroundMenu(rtbText.Handle,
e.X, e.Y, RTB1Options, RTB1MarkColor);
}
}

private void rtbText_SelectionChanged(object sender, EventArgs e)
{
SpellingCheckerEngine.CheckCtrlBackgroundNotify(rtbText.Handle,
RTB1Options, RTB1MarkColor);
}

private void rtbText_TextChanged(object sender, EventArgs e)
{
SpellingCheckerEngine.CheckCtrlBackgroundNotify(rtbText.Handle,
RTB1Options, RTB1MarkColor);
}

private void tbSpellCheck_Click(object sender, EventArgs e)
{
SpellingCheckerEngine.CheckCtrlDlg(this.Handle, rtbText.Handle, false);
}

[/sourcecode]