示例#1
0
文件: TextBox.cs 项目: xvwvx/Myra
        private void DeleteChars(int pos, int l)
        {
            if (l == 0)
            {
                return;
            }

            UserText = UserText.Substring(0, pos) + UserText.Substring(pos + l);
        }
示例#2
0
文件: TextBox.cs 项目: xvwvx/Myra
        private bool InsertChar(int pos, char ch)
        {
            if (string.IsNullOrEmpty(Text))
            {
                UserText = ch.ToString();
            }
            else
            {
                UserText = UserText.Substring(0, pos) + ch + UserText.Substring(pos);
            }

            return(true);
        }
示例#3
0
文件: TextBox.cs 项目: xvwvx/Myra
        private bool InsertChars(int pos, string s)
        {
            if (string.IsNullOrEmpty(s))
            {
                return(false);
            }

            if (string.IsNullOrEmpty(Text))
            {
                UserText = s;
            }
            else
            {
                UserText = UserText.Substring(0, pos) + s + UserText.Substring(pos);
            }

            return(true);
        }
示例#4
0
文件: TextBox.cs 项目: xvwvx/Myra
        public void Replace(int where, int len, string text)
        {
            if (len <= 0)
            {
                Insert(where, text);
                return;
            }

            text = Process(text);

            if (string.IsNullOrEmpty(text))
            {
                Delete(where, len);
                return;
            }

            UndoStack.MakeReplace(Text, where, len, text.Length);
            UserText = UserText.Substring(0, where) + text + UserText.Substring(where + len);
        }
示例#5
0
        protected void DeleteCharacter()
        {
            if (UserText.Length >= 1)
            {
                UserText = UserText.Substring(0, UserText.Length - 1);

                if (Building.Text.Length == 0 && Runs.Count > 0)
                {
                    Building = Runs.Last.Value;
                    Runs.RemoveLast();
                }

                if (Building.Text.Length > 0)
                {
                    Building.Text = Building.Text.Substring(0, Building.Text.Length - 1);
                }

                UpdateParagraph();
            }
        }