protected virtual void NotifyTextChanged( string text, int caretPosition, TextBoxChangeAction action) { this.OnTextChanged((EventArgs) new TextBoxChangedEventArgs(text, caretPosition, action)); }
protected virtual bool NotifyTextChanging( int startPosition, int length, string oldText, string newText, TextBoxChangeAction action) { TextBoxChangingEventArgs changingEventArgs = new TextBoxChangingEventArgs(startPosition, length, oldText, newText, action); this.OnTextChanging((TextChangingEventArgs)changingEventArgs); return(!changingEventArgs.Cancel); }
public TextBoxChangingEventArgs( int startPosition, int length, string oldText, string newText, TextBoxChangeAction action) : base(oldText, newText) { this.startPosition = startPosition; this.length = length; this.action = action; }
public virtual void EndEditUpdate( bool notify, string newText, int caretPosition, TextBoxChangeAction action) { if (this.editingCount <= 0) { return; } --this.editingCount; if (!notify) { return; } this.NotifyTextChanged(newText, caretPosition, action); }
public bool Replace(TextPosition startPosition, TextPosition endPosition, string text) { TextPosition.Swap(ref startPosition, ref endPosition); if (endPosition == (TextPosition)null && string.IsNullOrEmpty(text)) { return(false); } TextBoxChangeAction action = TextBoxChangeAction.TextEdit; int length = TextPosition.GetLength(startPosition, endPosition); string textRange = this.GetTextRange(startPosition, endPosition); if (textRange == text || !this.NotifyTextChanging((int)startPosition, length, textRange, text, action)) { return(false); } int caretPosition = (int)startPosition + (string.IsNullOrEmpty(text) ? 0 : text.Length); this.BeginEditUpdate(); this.ReplaceOverride(startPosition, endPosition, text); this.InvalidateLayout(); this.Invalidate(); this.EndEditUpdate(true, text, caretPosition, action); return(true); }
public TextBoxChangedEventArgs(string text, int caretPosition, TextBoxChangeAction action) { this.text = text; this.action = action; this.caretPosition = caretPosition; }