예제 #1
0
        public void Write(string text, Color backgroundColour, Color foregroundColor)
        {
            if (textEditorControl.InvokeRequired)
            {
                WriteInvoker invoker = new WriteInvoker(Write);
                textEditorControl.Invoke(invoker, new object[] { text, backgroundColour, foregroundColor });
            }
            else
            {
                int offset = textEditorControl.Document.PositionToOffset(new TextLocation(Column, Line));
                textEditorControl.ActiveTextAreaControl.TextArea.InsertString(text);

                if (!backgroundColour.IsEmpty)
                {
                    TextMarker marker = new TextMarker(offset, text.Length, TextMarkerType.SolidBlock, backgroundColour, foregroundColor);
                    textEditorControl.Document.MarkerStrategy.AddMarker(marker);
                    textEditorControl.Refresh();
                }
            }
        }