Пример #1
0
        private static void InsertTextCore(
			TextBox host, 
			string textToInsert,
			int selectionStart,
			int selectionLength)
        {
            // delete if overwriting something
            if (selectionLength > 0)
            {
                DeleteSelectionCore(host, selectionStart, selectionLength);
            }

            // modify the string
            if (selectionStart == host.DynamicString.Length)
            {
                host.DynamicString.Append(textToInsert);
            }
            else
            {
                host.DynamicString.Insert(selectionStart, textToInsert);
            }

            // update caret and selection
            host.SetCaretPosition(selectionStart + textToInsert.Length);
        }
Пример #2
0
        public CaretPositionChangedEventArgs(
			TextBox textControl,
			int oldPosition,
			int newPosition)
        {
            TextControl = textControl;
            OldPosition = oldPosition;
            NewPosition = newPosition;
        }
Пример #3
0
            public DeleteTextAction(
				TextBox hostTextBox, 
				int selStart, 
				int selLength
			)
                : base(hostTextBox)
            {
                selectionStart = selStart;
                selectionLength = selLength;
                deletedText = Textbox.Text.Substring(selectionStart, selectionLength);
            }
Пример #4
0
        private static void DeleteSelectionCore(
			TextBox host,
			int selectionStart,
			int selectionLength)
        {
            if (selectionLength <= 0)
            {
                return;
            }

            // modify the string
            host.DynamicString.Remove(selectionStart, selectionLength);

            // update caret and selection
            host.SetCaretPosition(selectionStart);
        }
Пример #5
0
 public TextBoxAction(TextBox hostTextBox)
 {
     Textbox = hostTextBox;
 }
Пример #6
0
            public InsertTextAction(
				TextBox hostTestBox, 
				string text,
				int selStart,
				int selLength
			)
                : base(hostTestBox)
            {
                selectionStart = selStart;
                selectionLength = selLength;
                textToInsert = text;
                deletedText = Textbox.Text.Substring(selectionStart, selectionLength);
            }
Пример #7
0
 private void mMyTextBox_TextBoxChangePending(TextBox sender, TextBoxChangeEventArgs e)
 {
     if (this.ActionManager != null && ShouldRecordActions)
     {
         IAction a = e.Action;
         e.Handled = true;
         this.ActionManager.RecordAction(a);
     }
 }
Пример #8
0
 public TextBoxBlock(string defaultText)
 {
     MyTextBox = new TextBox(defaultText);
     Init();
 }
Пример #9
0
 public TextBoxBlock()
 {
     MyTextBox = new TextBox();
     Init();
 }