Exemplo n.º 1
0
        public EditorControl(EditorSettings settings)
        {
            SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint
                     | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw
                     | ControlStyles.Selectable, true);
            Cursor    = Cursors.IBeam;
            TabStop   = true;
            AllowDrop = true;

            EditorSettings  = settings;
            TopMargins      = new MarginList(this);
            LeftMargins     = new MarginList(this);
            RightMargins    = new MarginList(this);
            BottomMargins   = new MarginList(this);
            Info            = new EditorInfo(this);
            CaretRenderer   = new CaretRenderer(this);
            Renderer        = new Renderer(this);
            Scroll          = new ScrollingManager(this);
            Locations       = new LocationManager(this);//+
            Folding         = new FoldingManager(this);
            CallTips        = new CallTipManager(this);
            MatchBrackets   = new MatchBracketManager(this);
            MatchWords      = new MatchWordManager(this);
            Autocomplete    = new AutocompleteManager(this);
            AffinityManager = new AffinityManager(this);
            Search          = new SearchManager(this);
            Styles          = new StyleManager(this);
            timer.Tick     += Tick;
        }
Exemplo n.º 2
0
        internal void DrawMargins(int start, Graphics g, MarginList margins)
        {
            var vertical = margins == editor.LeftMargins || margins == editor.RightMargins;
            var top      = margins == editor.TopMargins;

            foreach (var m in margins)
            {
                var bounds = default(Rectangle);

                if (vertical)
                {
                    bounds = new Rectangle(start, editor.Info.TextTop, m.CalculateSize(),
                                           editor.ClientSize.Height - editor.Info.TextTop); //HACK
                }
                else if (top)
                {
                    bounds = new Rectangle(0, start, editor.ClientSize.Width, m.CalculateSize());
                }
                else
                {
                    bounds = new Rectangle(editor.Info.TextLeft, start, editor.Info.TextWidth, m.CalculateSize());
                }

                m.Draw(g, bounds);
                start += m.CalculateSize();
            }
        }