Пример #1
0
        /// <summary>
        /// 复制选区
        /// </summary>
        public void CopySelection()
        {
            if (!isSelecting)
            {
                SystemSounds.Beep.Play();
                return;
            }
            StringBuilder selection = new StringBuilder(selectionLength + 1);

            CoreMethods.GetSelection(ref selectionStartPos, ref selectionEndPos, selection);
            Clipboard.SetText(selection.ToString(), TextDataFormat.Text);
        }
Пример #2
0
        /// <summary>
        /// 剪切选区
        /// </summary>
        public void CutSelection()
        {
            if (!isSelecting)
            {
                SystemSounds.Beep.Play();
                return;
            }
            StringBuilder selection = new StringBuilder(selectionLength + 1);

            CoreMethods.GetSelection(ref selectionStartPos, ref selectionEndPos, selection);
            Clipboard.SetText(selection.ToString(), TextDataFormat.Text);
            if (!CoreMethods.Remove(ref selectionStartPos, ref selectionEndPos))
            {
                if (DebugMsgSend != null)
                {
                    DebugMsgSend("::Remove failed!");
                }
            }
            ScrollTo(selectionStartPos);
            ClearSelection();
            UpdateText();
        }