[]
        
(Showing Draft Content)

C1.Win.C1SpellChecker.C1SpellChecker.CheckControl

CheckControl Method

CheckControl(ISpellCheckableEditor, bool, ISpellDialog)

Shows a spell-checking dialog for an editor and returns the number of spelling errors found.

Declaration
public int CheckControl(ISpellCheckableEditor editor, bool fromCursor, ISpellDialog dlg)
Parameters
Type Name Description
ISpellCheckableEditor editor

ISpellCheckableEditor that contains the text to be spell-checked.

bool fromCursor

Whether to check only from the cursor position or the entire control contents.

ISpellDialog dlg

Dialog that implements the ISpellDialog interface used for displaying and correcting errors.

Returns
Type Description
int

The number of errors found, or -1 if the dialog was canceled.

Remarks

For an example, see the CheckControl(TextBoxBase, bool, ISpellDialog) method.

CheckControl(ISpellCheckableEditor, bool)

Shows a spell-checking dialog for an editor and returns the number of spelling errors found.

Declaration
public int CheckControl(ISpellCheckableEditor editor, bool fromCursor)
Parameters
Type Name Description
ISpellCheckableEditor editor

ISpellCheckableEditor that contains the text to be spell-checked.

bool fromCursor

Whether to check only from the cursor position or the entire control contents.

Returns
Type Description
int

The number of errors found, or -1 if the dialog was canceled.

Remarks

For an example, see the CheckControl(TextBoxBase, bool, ISpellDialog) method.

CheckControl(ISpellCheckableEditor)

Shows a spell-checking dialog for an editor and returns the number of spelling errors found.

Declaration
public int CheckControl(ISpellCheckableEditor editor)
Parameters
Type Name Description
ISpellCheckableEditor editor

ISpellCheckableEditor that contains the text to be spell-checked.

Returns
Type Description
int

The number of errors found, or -1 if the dialog was canceled.

CheckControl(TextBoxBase, bool, ISpellDialog)

Shows a spell-checking dialog for an editor, returns the number of spelling errors found.

Declaration
public int CheckControl(TextBoxBase editor, bool fromCursor, ISpellDialog dlg)
Parameters
Type Name Description
TextBoxBase editor

TextBoxBase control that contains the text to be spell-checked.

bool fromCursor

Whether to check only from the cursor position or the entire control contents.

ISpellDialog dlg

Dialog that implements the ISpellDialog interface used for displaying and correcting errors.

Returns
Type Description
int

The number of errors found, -1 if the dialog was canceled.

Remarks

You can use this method to invoke the spell-checker using a custom spell dialog, or using the built-in C1SpellDialog.

Examples

The code below uses the CheckControl method with an instance of the C1SpellDialog and attaches some event handlers to display the spell-checking progress in a status bar.

private void btnSpell_Click(object sender, EventArgs e)
{
  // create spell-checking dialog
  using (C1SpellDialog dlg = new C1SpellDialog())
  {
    // connect event handler
    dlg.ErrorDisplayed += new EventHandler(dlg_ErrorDisplayed);

    // spell-check the 'textBox' control
    c1SpellChecker1.CheckControl(this.textBox, false, dlg);
  }
}
void dlg_ErrorDisplayed(object sender, EventArgs e)
{
  // get the C1SpellDialog that fired the event
  C1SpellDialog dlg = sender as C1SpellDialog;

  // show information about the error currently displayed
  statusLabel1.Text = string.Format("Error {0} of {1}: '{2}'",
    dlg.ErrorIndex + 1, dlg.ErrorCount, dlg.CurrentError.Text);
}

CheckControl(TextBoxBase, bool)

Shows a spell-checking dialog for an editor, returns the number of spelling errors found.

Declaration
public int CheckControl(TextBoxBase editor, bool fromCursor)
Parameters
Type Name Description
TextBoxBase editor

TextBoxBase control that contains the text to be spell-checked.

bool fromCursor

Whether to check only from the cursor position or the entire control contents.

Returns
Type Description
int

The number of errors found, -1 if the dialog was canceled.

CheckControl(TextBoxBase)

Shows a spell-checking dialog for an editor, returns the number of spelling errors found.

Declaration
public int CheckControl(TextBoxBase editor)
Parameters
Type Name Description
TextBoxBase editor

TextBoxBase control that contains the text to be spell-checked.

Returns
Type Description
int

The number of errors found, -1 if the dialog was canceled.

CheckControl(WebBrowser)

Shows a spell-checking dialog for a browser, returns the number of spelling errors found.

Declaration
public int CheckControl(WebBrowser browser)
Parameters
Type Name Description
WebBrowser browser

WebBrowser control that contains the text to be spell-checked.

Returns
Type Description
int

The number of errors found, -1 if the dialog was canceled.

CheckControl(WebBrowser, bool)

Shows a spell-checking dialog for a browser, returns the number of spelling errors found.

Declaration
public int CheckControl(WebBrowser browser, bool fromCursor)
Parameters
Type Name Description
WebBrowser browser

WebBrowser control that contains the text to be spell-checked.

bool fromCursor

Whether to check only from the cursor position or the entire control contents.

Returns
Type Description
int

The number of errors found, -1 if the dialog was canceled.

CheckControl(WebBrowser, bool, ISpellDialog)

Shows a spell-checking dialog for a browser, returns the number of spelling errors found.

Declaration
public int CheckControl(WebBrowser browser, bool fromCursor, ISpellDialog dlg)
Parameters
Type Name Description
WebBrowser browser

WebBrowser control that contains the text to be spell-checked.

bool fromCursor

Whether to check only from the cursor position or the entire control contents.

ISpellDialog dlg

Dialog that implements the ISpellDialog interface used for displaying and correcting errors.

Returns
Type Description
int

The number of errors found, -1 if the dialog was canceled.

CheckControl(Control, object)

Shows a spell-checking dialog for a control which supports the IHtmlDocument2 interface, returns the number of spelling errors found.

Declaration
public int CheckControl(Control control, object browser)
Parameters
Type Name Description
Control control

Control control that is used as a parent to show a spell checking dialog.

object browser

Reference to an IWebBrowser2 interface.

Returns
Type Description
int

The number of errors found, -1 if the dialog was canceled.

CheckControl(Control, object, bool)

Shows a spell-checking dialog for a control which supports the IHtmlDocument2 interface, returns the number of spelling errors found.

Declaration
public int CheckControl(Control control, object browser, bool fromCursor)
Parameters
Type Name Description
Control control

Control control that is used as a parent to show a spell checking dialog.

object browser

Reference to an IWebBrowser2 interface.

bool fromCursor

Whether to check only from the cursor position or the entire control contents.

Returns
Type Description
int

The number of errors found, -1 if the dialog was canceled.

CheckControl(Control, object, bool, ISpellDialog)

Shows a spell-checking dialog for a control which supports the IHtmlDocument2 interface, returns the number of spelling errors found.

Declaration
public int CheckControl(Control control, object browser, bool fromCursor, ISpellDialog dlg)
Parameters
Type Name Description
Control control

Control control that is used as a parent to show a spell checking dialog.

object browser

Reference to an IWebBrowser2 interface.

bool fromCursor

Whether to check only from the cursor position or the entire control contents.

ISpellDialog dlg

Dialog that implements the ISpellDialog interface used for displaying and correcting errors.

Returns
Type Description
int

The number of errors found, -1 if the dialog was canceled.