示例#1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            var graphics = e.Graphics;

            graphics.PageUnit = GraphicsUnit.Pixel;

            var scrollPoint = AutoScrollPosition;

            graphics.TranslateTransform(scrollPoint.X, scrollPoint.Y);

            //Zoom
            using (var matrix = graphics.Transform)
            {
                var graphicsContainer = graphics.BeginContainer();

                graphics.SmoothingMode      = Document.SmoothingMode;
                graphics.PixelOffsetMode    = Document.PixelOffsetMode;
                graphics.CompositingQuality = Document.CompositionQuality;

                graphics.ScaleTransform(Document.Zoom, Document.Zoom);

                var clipRectangle = Gsc2Goc(e.ClipRectangle);

                Document.DrawElements(graphics, clipRectangle);

                if (!((_resizeAction != null) && _resizeAction.IsResizing))
                {
                    Document.DrawSelections(graphics, e.ClipRectangle);
                }

                if (_isMultiSelection || _isAddSelection)
                {
                    DrawSelectionRectangle(graphics);
                }

                if (_isAddLink)
                {
                    _linkLine.CalcLink();
                    _linkLine.Draw(graphics);
                }
                if ((_resizeAction != null) && !((_moveAction != null) && _moveAction.IsMoving))
                {
                    _resizeAction.DrawResizeCorner(graphics);
                }

                if (_mousePointerElement != null)
                {
                    if (_mousePointerElement is IControllable)
                    {
                        var ctrl = ((IControllable)_mousePointerElement).GetController();
                        ctrl.DrawSelection(graphics);
                    }
                }

                graphics.EndContainer(graphicsContainer);
                graphics.Transform = matrix;
            }

            base.OnPaint(e);
        }
示例#2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            var g = e.Graphics;

            g.PageUnit = GraphicsUnit.Pixel;

            var scrollPoint = AutoScrollPosition;

            g.TranslateTransform(scrollPoint.X, scrollPoint.Y);

            //Zoom
            var mtx = g.Transform;
            var gc  = g.BeginContainer();

            g.SmoothingMode      = _document.SmoothingMode;
            g.PixelOffsetMode    = _document.PixelOffsetMode;
            g.CompositingQuality = _document.CompositingQuality;

            g.ScaleTransform(_document.Zoom, _document.Zoom);

            var clipRectangle = Gsc2Goc(e.ClipRectangle);

            _document.DrawElements(g, clipRectangle);

            if (!((_resizeAction != null) && (_resizeAction.IsResizing)))
            {
                _document.DrawSelections(g, e.ClipRectangle);
            }

            if ((_isMultiSelection) || (_isAddSelection))
            {
                DrawSelectionRectangle(g);
            }

            if (_isAddLink)
            {
                _linkLine.CalcLink();
                _linkLine.Draw(g);
            }
            if ((_resizeAction != null) && (!((_moveAction != null) && (_moveAction.IsMoving))))
            {
                _resizeAction.DrawResizeCorner(g);
            }

            if (_mousePointerElement != null)
            {
                if (_mousePointerElement is IControllable)
                {
                    var ctrl = ((IControllable)_mousePointerElement).GetController();
                    ctrl.DrawSelection(g);
                }
            }

            g.EndContainer(gc);
            g.Transform = mtx;

            base.OnPaint(e);
        }