/// <summary> /// This is the method that is responsible for notifying /// receivers that the event occurred /// </summary> protected virtual void OnReplacedWord(ReplaceWordEventArgs e) { if (ReplacedWord != null) { ReplacedWord(this, e); } }
private void SpellingReplacedWord(object sender, ReplaceWordEventArgs e) { var start = TextBox.SelectionStart; var length = TextBox.SelectionLength; TextBox.Select(e.TextIndex, e.Word.Length); TextBox.SelectedText = e.ReplacementWord; if (start > TextBox.Text.Length) start = TextBox.Text.Length; if ((start + length) > TextBox.Text.Length) length = 0; TextBox.Select(start, length); }
/// <summary> /// This is the method that is responsible for notifying /// receivers that the event occurred /// </summary> protected virtual void OnReplacedWord(ReplaceWordEventArgs e) { ReplacedWord?.Invoke(this, e); }
private void SpellChecker_ReplacedWord(object sender, ReplaceWordEventArgs e) { _lastReplaceEvent = e; _lastEvent = EventNames.ReplacedWord; }
private void ResetEvents() { // reset event data _lastSpellingEvent = null; _lastReplaceEvent = null; _lastEvent = EventNames.None; }
private void _spelling_ReplacedWord(object sender, ReplaceWordEventArgs e) { switch (this._currentReason) { case CallReasons.TextBox: int start = this._currentTextBox.SelectionStart; int length = this._currentTextBox.SelectionLength; this._currentTextBox.Select(e.TextIndex, e.Word.Length); this._currentTextBox.SelectedText = e.ReplacementWord; if (start > this._currentTextBox.Text.Length) start = this._currentTextBox.Text.Length; if ((start + length) > this._currentTextBox.Text.Length) length = 0; this._currentTextBox.Select(start, length); break; } }