Exemplo n.º 1
0
        public override void Draw(System.Drawing.Graphics g)
        {
            if (g == null)
            {
                throw new System.ArgumentNullException("g");
            }

            if (base.Dragging)
            {
                System.Drawing.Rectangle rectangle = GetViewportRectangle();

                if (base.Brush != null)
                {
                    System.Drawing.Drawing2D.Matrix prevBrushMatrix = PathVObjectCreateDesigner.AdaptBrushToViewport(base.Brush, this.VObjectHost.HostViewer);
                    try
                    {
                        g.FillEllipse(base.Brush, rectangle);
                    }
                    finally
                    {
                        if (prevBrushMatrix != null)
                        {
                            VObjectsUtils.SetBrushMatrix(base.Brush, prevBrushMatrix);
                        }
                    }
                }

                if (base.Pen != null)
                {
                    using (System.Drawing.Pen pen = CreateViewportPen())
                        g.DrawEllipse(pen, rectangle);
                }
            }
        }
        public override void Draw(System.Drawing.Graphics g)
        {
            if (g == null)
            {
                throw new System.ArgumentNullException("g");
            }

            if (_points.Count > 0)
            {
                System.Drawing.Point[] points = GetViewportPoints(_points.Count + 1);
                points[points.Length - 1] = _viewportMousePosition;

                if (_closePath)
                {
                    if (base.Brush != null)
                    {
                        System.Drawing.Drawing2D.Matrix prevBrushMatrix = PathVObjectCreateDesigner.AdaptBrushToViewport(base.Brush, this.VObjectHost.HostViewer);
                        try
                        {
                            g.FillPolygon(base.Brush, points, _fillMode);
                        }
                        finally
                        {
                            if (prevBrushMatrix != null)
                            {
                                VObjectsUtils.SetBrushMatrix(base.Brush, prevBrushMatrix);
                            }
                        }
                    }
                    if (base.Pen != null)
                    {
                        g.DrawPolygon(base.CreateViewportPen(), points);
                    }
                }
                else
                {
                    if (base.Pen != null)
                    {
                        g.DrawLines(base.CreateViewportPen(), points);
                    }
                }
            }
        }
        public override void Draw(System.Drawing.Graphics g)
        {
            if (g == null)
            {
                throw new System.ArgumentNullException("g");
            }

            if (_points.Count > 1)
            {
                using (System.Drawing.Pen pen = CreateViewportPen())
                {
                    System.Drawing.Point[] points = (System.Drawing.Point[])_points.ToArray(typeof(System.Drawing.Point));

                    if (_closePath)
                    {
                        if (base.Brush != null)
                        {
                            System.Drawing.Drawing2D.Matrix prevBrushMatrix = PathVObjectCreateDesigner.AdaptBrushToViewport(base.Brush, base.VObjectHost.HostViewer);
                            try
                            {
                                g.FillPolygon(base.Brush, points, _fillMode);
                            }
                            finally
                            {
                                if (prevBrushMatrix != null)
                                {
                                    VObjectsUtils.SetBrushMatrix(base.Brush, prevBrushMatrix);
                                }
                            }
                        }
                        g.DrawPolygon(pen, points);
                    }
                    else
                    {
                        g.DrawLines(pen, points);
                    }
                }
            }
        }