// ** dialog event handlers void dlg_Load(object sender, EventArgs e) { SpellDialog dlg = sender as SpellDialog; if (dlg != null) { status.Text = string.Format("Checking spelling... {0}", dlg.ErrorCount); } else { SpellDialogWord dlgw = sender as SpellDialogWord; status.Text = string.Format("Checking spelling... {0}", dlgw.ErrorCount); } Console.WriteLine(this.status.Text); }
void dlg_FormClosed(object sender, FormClosedEventArgs e) { SpellDialog dlg = sender as SpellDialog; if (dlg != null) { status.Text = string.Format("Spell-check done, {0} errors handled; result {1}.", dlg.ErrorCount, dlg.DialogResult); } else { SpellDialogWord dlgw = sender as SpellDialogWord; status.Text = string.Format("Spell-check done, {0} errors handled; result {1}.", dlgw.ErrorCount, dlgw.DialogResult); } Console.WriteLine(this.status.Text); }
// ** spell check editors private void btnSpellCheck_Click(object sender, EventArgs e) { using (SpellDialog dlg = new SpellDialog()) { dlg.Load += new EventHandler(dlg_Load); dlg.FormClosed += new FormClosedEventHandler(dlg_FormClosed); if (_checkRichTextBox) { c1SpellChecker1.CheckControl(textBox1, false, dlg); } else { c1SpellChecker1.CheckControl(textBox1, false, dlg); } } }