コード例 #1
0
        public void AppendText(string newText)
        {
            _settingText = true;
            BeginUpdate();
            try
            {
                TextLocation oldEndPoint = Document.OffsetToPosition(Document.TextLength);

                bool oldReadOnly = Document.ReadOnly;
                Document.ReadOnly = false;

                if ((Document.TextLength > 0) && (newText.Length > 0))
                {
                    Document.Insert(Document.TextLength, "\r\n");
                }
                Document.Insert(Document.TextLength, newText);

                Document.ReadOnly = oldReadOnly;

                ActiveTextAreaControl.Caret.Position = oldEndPoint;
                ActiveTextAreaControl.ScrollToCaret();
            }
            finally
            {
                _settingText = false;
                EndUpdate();
            }

            Refresh();              // if this isn't done then half the loaded text won't show up.
        }
コード例 #2
0
ファイル: NodeRichTextBox.cs プロジェクト: tyranid/canape
        private void SetSelection(int index, int length)
        {
            ActiveTextAreaControl.SelectionManager.ClearSelection();

            TextLocation startSelection = ActiveTextAreaControl.Document.OffsetToPosition(index);
            TextLocation endSelection   = ActiveTextAreaControl.Document.OffsetToPosition(index + length);

            ActiveTextAreaControl.SelectionManager.SetSelection(startSelection, endSelection);
            ActiveTextAreaControl.Caret.Position = startSelection;
            ActiveTextAreaControl.ScrollTo(startSelection.Line, startSelection.Column);
        }
コード例 #3
0
 public TextEditorControl Append(string s, bool refresh = true)
 {
     // http://community.icsharpcode.net/forums/t/9931.aspx
     // Is this really the best way to do this?
     Document.Insert(Document.TextLength, s);
     if (refresh)
     {
         ActiveTextAreaControl.JumpTo(Document.TotalNumberOfLines,
                                      Document.LineSegmentCollection[Document.TotalNumberOfLines - 1].Length, true);
     }
     return(this);
 }
コード例 #4
0
        private void TextChangedEventHandler(object sender, EventArgs e)
        {
            var editor = sender as TextEditorControlEx;

            if (editor != null)
            {
                bool vScrollBarIsNeeded = editor.Document.TotalNumberOfLines > ActiveTextAreaControl.TextArea.TextView.VisibleLineCount;
                if (ActiveTextAreaControl.VScrollBar.Visible && HideVScrollBarIfPossible && !vScrollBarIsNeeded)
                {
                    ActiveTextAreaControl.ShowScrollBars(Orientation.Vertical, false);
                }
            }
        }
コード例 #5
0
        public void SetText(string newText)
        {
            _settingText = true;
            BeginUpdate();
            try
            {
                Document.TextContent = _repairCRLF.Replace(newText, "\r\n");
                Document.UndoStack.ClearAll();
                Document.BookmarkManager.Clear();
                Document.UpdateQueue.Clear();
                ActiveTextAreaControl.Caret.Position = TextLocation.Empty;
                ActiveTextAreaControl.ScrollToCaret();
            }
            finally
            {
                _settingText = false;
                EndUpdate();
            }

            Refresh();              // if this isn't done then half the loaded text won't show up.
        }
コード例 #6
0
ファイル: CodeEditor.cs プロジェクト: microdee/vvvv-sdk
 public void JumpTo(int line, int column)
 {
     ActiveTextAreaControl.ScrollTo(line, column);
     ActiveTextAreaControl.Caret.Line   = line;
     ActiveTextAreaControl.Caret.Column = column;
 }
コード例 #7
0
 private void DoSelectAll()
 {
     new SelectWholeDocument().Execute(ActiveTextAreaControl.TextArea);
     ActiveTextAreaControl.Focus();
 }
コード例 #8
0
 private void DoPaste()
 {
     new Paste().Execute(ActiveTextAreaControl.TextArea);
     ActiveTextAreaControl.Focus();
 }
コード例 #9
0
 private void DoCopy()
 {
     new Copy().Execute(ActiveTextAreaControl.TextArea);
     ActiveTextAreaControl.Focus();
 }