示例#1
0
        protected TextView(ITextDocument textDocument, ISettings settings, IScrollHost scrollHost = null)
            : base(settings)
        {
            SetStyle(ControlStyles.Selectable | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);

            foreach (var column in ALL_TEXT_COLUMNS)
            {
                this._textColumns.Add(column);
            }

            SuspendLayout();

            // Set some useful default properties
            this.Cursor      = Cursors.IBeam;
            this.Caret       = new Caret(this);
            this.ForeColor   = Color.Black;
            this.BackColor   = Color.White;
            this._lineHeight = this.Font.Height;

            this.ScrollHost = scrollHost;

            this.Padding = new Padding(4, 0, 4, 0);

            this._imeComposition = new IMEComposition(this);

            this.RenderUnsavedMarker = true;

            this.AddStyle(
                new TextStyleManual(
                    "Selection",
                    "Selection",
                    "The style for the selection.",
                    SystemColors.HighlightText, SystemColors.Highlight,
                    null,
                    TextStyleDisplayMode.Always,
                    TextStylePaintMode.Inline)
            {
                RenderZIndex = 1
            });

            this.AddStyle(
                new TextStyleManual(
                    "Default",
                    "Default",
                    "The default text style for the text",
                    this.ForeColor, Color.Transparent,
                    this.Font,
                    TextStyleDisplayMode.Always,
                    TextStylePaintMode.Inline));

            // Initialize the text buffer by sending in our document!
            this.InitializeTextBuffer(textDocument);

            ResumeLayout();
        }
示例#2
0
 public WindowsTextControl(ITextDocument textDocument, ISettings settings, IScrollHost scrollHost)
     : base(textDocument, settings, scrollHost)
 {
 }