Esempio n. 1
0
 public void VisitShapeDraw(ShapeDraw shapeDraw)
 {
     if (shapeDraw.BackColor != Color.Empty)
     {
         ShapePaintHelper.FillRectangle(Graphics, ResourceCache.DefaultCache.GetSolidBrush(shapeDraw.BackColor), shapeDraw.VirtualBounds);
     }
 }
Esempio n. 2
0
        private static void PaintFigure(Graphics g, RectangleF innbounds, ShapeFigure shape, int borderwidth)
        {
            using (GraphicsPath gp = new GraphicsPath())
            {
                switch (shape.Type)
                {
                case ShapeType.Rectangle:
                    gp.AddRectangle(ShapePaintHelper.GetNormalizedRectangle(Rectangle.Round(innbounds)));
                    break;

                case ShapeType.Ellipse:
                    gp.AddEllipse(ShapePaintHelper.GetNormalizedRectangle(Rectangle.Round(innbounds)));
                    break;

                case ShapeType.UpArrow:
                    gp.AddPolygon(Rect2PointFArray(Rectangle.Round(innbounds), ArrowDirection.Up));
                    break;

                case ShapeType.DownArrow:
                    gp.AddPolygon(Rect2PointFArray(Rectangle.Round(innbounds), ArrowDirection.Down));
                    break;

                case ShapeType.RightArrow:
                    gp.AddPolygon(Rect2PointFArray(Rectangle.Round(innbounds), ArrowDirection.Right));
                    break;

                case ShapeType.LeftArrow:
                    gp.AddPolygon(Rect2PointFArray(Rectangle.Round(innbounds), ArrowDirection.Left));
                    break;

                default:
                    return;
                }
                if (shape.Filled)
                {
                    g.FillPath(ResourceCache.DefaultCache.GetSolidBrush(shape.FillColor), gp);
                }

                using (Pen pen = ResourceCache.DefaultCache.GetPen(shape.BorderColor, borderwidth, PenAlignment.Inset, shape.LineDashStyle))
                    g.DrawPath(pen, gp);
            }
        }