Example #1
0
        public MarginBar()
        {
            using (Graphics g = CreateGraphics())
            {
                _Dpi = g.DpiX;
            }

            _HangingIndent = new MarginBarMarker(MarkerAlign.Top, _Dpi, 0, false, PointerWidth, PointerHeight, GetMarkerTop(MarkerAlign.Top));
            _LeftMargin    = new MarginBarMarker(MarkerAlign.Bottom, _Dpi, 0, false, PointerWidth, PointerHeight, GetMarkerTop(MarkerAlign.Bottom));
#if DEBUG
            _LeftMargins = new MarginBarButton(MarkerAlign.Top, _Dpi, 0, false, ButtonWidth, ButtonHeight, 0);
#endif
            _RightMargin = new MarginBarMarker(MarkerAlign.Bottom, _Dpi, 0, true, PointerWidth, PointerHeight, GetMarkerTop(MarkerAlign.Bottom));

            ImageMarkerDashStyle = DashStyle.Dash;
            ImageMarkerLineColor = DefaultForeColor;
            InitializeComponent();
            InitializePaint();
        }
Example #2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            _Markers.Clear();
            _PushedMarkers.Clear();

            if (!_DoubleBufferedGraphics.Initialized)
            {
                _DoubleBufferedGraphics.Initialize(Width, Height);
            }

            base.OnPaint(new PaintEventArgs(_DoubleBufferedGraphics.Graphics, e.ClipRectangle));

            DrawRuler(_DoubleBufferedGraphics.Graphics);

            if (_ShowHangingIndent)
            {
                if (_HangingIndent.Pushed)
                {
                    _PushedMarkers.Add(_HangingIndent);
                }
                else
                {
                    _Markers.Add(_HangingIndent);
                }
            }

            if (_ShowLeftMargin)
            {
#if DEBUG
                if (_LeftMargins.Pushed)
                {
                    _PushedMarkers.Add(_LeftMargins);
                }
                else
                {
                    _Markers.Add(_LeftMargins);
                }
#endif
                if (_LeftMargin.Pushed)
                {
                    _PushedMarkers.Add(_LeftMargin);
                }
                else
                {
                    _Markers.Add(_LeftMargin);
                }
            }

            if (_ShowRightMargin)
            {
                if (_RightMargin.Pushed)
                {
                    _PushedMarkers.Add(_RightMargin);
                }
                else
                {
                    _Markers.Add(_RightMargin);
                }
            }

            foreach (MarginBarMarkerBase marginBarMarkerBase in _Markers)
            {
                marginBarMarkerBase.Paint(_DoubleBufferedGraphics.Graphics, Padding.Left, GetActualRulerLength());
            }

            foreach (MarginBarMarkerBase marginBarMarkerBase in _PushedMarkers)
            {
                MarginBarMarker marginBarMarker = marginBarMarkerBase as MarginBarMarker;

                if (marginBarMarker != null)
                {
                    InvalidateImageMarkerControl(marginBarMarker);
                }

                marginBarMarkerBase.Paint(_DoubleBufferedGraphics.Graphics, Padding.Left, GetActualRulerLength());
            }

            _DoubleBufferedGraphics.Render(e.Graphics);
        }