示例#1
0
 /// <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);
     }
 }
示例#2
0
 /// <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);
     }
 }
示例#3
0
        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);
        }
示例#4
0
 /// <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);
 }
示例#5
0
 private void SpellChecker_ReplacedWord(object sender, ReplaceWordEventArgs e)
 {
     _lastReplaceEvent = e;
     _lastEvent = EventNames.ReplacedWord;
 }
示例#6
0
 private void ResetEvents()
 {
     // reset event data
     _lastSpellingEvent = null;
     _lastReplaceEvent = null;
     _lastEvent = EventNames.None;
 }
示例#7
0
 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;
     }
 }