コード例 #1
0
        /// <summary>
        /// Adds to current text in workspace given character in passed position.
        /// </summary>
        public void Insert_To_WorkSpace(int start_Index, char sign)
        {
            int CaretPosition = WorkSpace.CaretIndex;

            WorkSpace.Text = WorkSpace.Text.Insert(start_Index, sign.ToString());

            WorkSpace.CaretIndex = ++CaretPosition;

            WorkSpace.Focus();
        }
コード例 #2
0
        /// <summary>
        /// Adds to current text in workspace given string in caret position.
        /// </summary>
        public void Insert_To_WorkSpace(string str)
        {
            int CaretPosition = WorkSpace.CaretIndex;

            WorkSpace.Text = WorkSpace.Text.Insert(CaretPosition, str);
            CaretPosition += str.Length;

            WorkSpace.CaretIndex = CaretPosition;
            WorkSpace.Focus();
        }
コード例 #3
0
        /// <summary>
        /// Removes character preceding caret in workspace.
        /// </summary>
        private void BackSpace_WorkSpace()
        {
            int CaretPosition = WorkSpace.CaretIndex;

            if (CaretPosition > 0)
            {
                CaretPosition--;
                WorkSpace.Text       = WorkSpace.Text.Remove(CaretPosition, 1);
                WorkSpace.CaretIndex = CaretPosition;
            }
            WorkSpace.Focus();
        }
コード例 #4
0
        /// <summary>
        /// Adds to current text in workspace given character in caret position.
        /// </summary>
        private void Insert_To_WorkSpace(char sign)
        {
            int CaretPosition = WorkSpace.CaretIndex;

            if (WorkSpace.SelectionLength == 0)
            {
                WorkSpace.Text = WorkSpace.Text.Insert(CaretPosition++, sign.ToString());
            }
            else
            {
                WorkSpace.Text = WorkSpace.Text.Remove(CaretPosition, WorkSpace.SelectionLength);
                WorkSpace.Text = WorkSpace.Text.Insert(CaretPosition++, sign.ToString());
            }

            WorkSpace.CaretIndex = CaretPosition;
            WorkSpace.Focus();
        }
コード例 #5
0
        /// <summary>
        /// Adds to current text in workspace given string in passed position.
        /// Removes a specified number of characters in the work space at a specified position.
        /// </summar
        public void Remove_From_WorkSpace(int start_Index, int count)
        {
            int CaretPosition = WorkSpace.CaretIndex;

            try
            {
                WorkSpace.Text = WorkSpace.Text.Remove(start_Index, count);

                CaretPosition -= count;

                WorkSpace.CaretIndex = CaretPosition;
            }
            catch (ArgumentOutOfRangeException)
            {
                WorkSpace.Text = WorkSpace.Text.Substring(start_Index);

                WorkSpace.CaretIndex = WorkSpace.Text.Length;
            }

            WorkSpace.Focus();
        }
コード例 #6
0
 /// <summary>
 /// Clears whole text in workspace.
 /// </summary>
 private void Clear_WorkSpace()
 {
     WorkSpace.Clear();
     WorkSpace.CaretIndex = 0;
     WorkSpace.Focus();
 }
コード例 #7
0
 private void Move_WorkSpace_Carret_To_End()
 {
     WorkSpace.CaretIndex = WorkSpace.Text.Length;
     WorkSpace.Focus();
 }