示例#1
0
        public static Polyline AddPolyline(this Canvas canvas, ShapeStyle shapeStyle, params Point[] points)
        {
            Polyline polyline = new Polyline();

            foreach (var point in points)
            {
                polyline.Points.Add(point);
            }
            polyline.UpdateShape(shapeStyle);

            canvas.Children.Add(polyline);
            return(polyline);
        }
示例#2
0
        public static Ellipse AddEllipse(this Canvas canvas, double x, double y, double width, double height, ShapeStyle shapeStyle)
        {
            Ellipse ellipse = new Ellipse
                {
                    Width = width,
                    Height = height
                };
            ellipse.UpdateShape(shapeStyle);
            Canvas.SetLeft(ellipse, x);
            Canvas.SetTop(ellipse, y);

            canvas.Children.Add(ellipse);
            return ellipse;
        }
示例#3
0
        public static Line AddLine(this Canvas canvas, double x1, double y1, double x2, double y2, ShapeStyle shapeStyle)
        {
            Line line = new Line()
                {
                    X1 = x1,
                    Y1 = y1,
                    X2 = x2,
                    Y2 = y2
                };
            line.UpdateShape(shapeStyle);

            canvas.Children.Add(line);
            return line;
        }
示例#4
0
 public static Ellipse AddEllipse(this Canvas canvas, Point point, Size size, ShapeStyle shapeStyle)
 {
     return AddEllipse(canvas, new Rect(point, size), shapeStyle);
 }
示例#5
0
 public static Rectangle AddRectangle(this Canvas canvas, Point point, Size size, ShapeStyle shapeStyle)
 {
     return AddRectangle(canvas, new Rect(point, size), shapeStyle);
 }
示例#6
0
        public static Rectangle AddRectangle(this Canvas canvas, double x, double y, double width, double height, ShapeStyle shapeStyle)
        {
            Rectangle rectangle = new Rectangle
                {
                    Width = width,
                    Height = height
                };
            rectangle.UpdateShape(shapeStyle);
            Canvas.SetLeft(rectangle, x);
            Canvas.SetTop(rectangle, y);

            canvas.Children.Add(rectangle);
            return rectangle;
        }
示例#7
0
        public static Polyline AddPolyline(this Canvas canvas, ShapeStyle shapeStyle, params Point[] points)
        {
            Polyline polyline = new Polyline();
            foreach (var point in points)
            {
                polyline.Points.Add(point);
            }
            polyline.UpdateShape(shapeStyle);

            canvas.Children.Add(polyline);
            return polyline;
        }
示例#8
0
 public static void UpdateShape(this Shape shape, ShapeStyle shapeStyle)
 {
     UpdateShape(shape, shapeStyle.StrokeStyle, shapeStyle.FillStyle);
 }
示例#9
0
 public static Line AddLine(this Canvas canvas, Point p1, Point p2, ShapeStyle shapeStyle)
 {
     return AddLine(canvas, p1.X, p1.Y, p2.X, p2.Y, shapeStyle);
 }
示例#10
0
 public static Ellipse AddEllipse(this Canvas canvas, Point point, Size size, ShapeStyle shapeStyle)
 {
     return(AddEllipse(canvas, new Rect(point, size), shapeStyle));
 }
示例#11
0
        public static Ellipse AddEllipse(this Canvas canvas, double x, double y, double width, double height, ShapeStyle shapeStyle)
        {
            Ellipse ellipse = new Ellipse
            {
                Width  = width,
                Height = height
            };

            ellipse.UpdateShape(shapeStyle);
            Canvas.SetLeft(ellipse, x);
            Canvas.SetTop(ellipse, y);

            canvas.Children.Add(ellipse);
            return(ellipse);
        }
示例#12
0
        public static Rectangle AddRectangle(this Canvas canvas, double x, double y, double width, double height, ShapeStyle shapeStyle)
        {
            Rectangle rectangle = new Rectangle
            {
                Width  = width,
                Height = height
            };

            rectangle.UpdateShape(shapeStyle);
            Canvas.SetLeft(rectangle, x);
            Canvas.SetTop(rectangle, y);

            canvas.Children.Add(rectangle);
            return(rectangle);
        }
示例#13
0
 public static Line AddLine(this Canvas canvas, Point p1, Point p2, ShapeStyle shapeStyle)
 {
     return(AddLine(canvas, p1.X, p1.Y, p2.X, p2.Y, shapeStyle));
 }
示例#14
0
 protected bool Equals(ShapeStyle other)
 {
     return(Equals(StrokeStyle, other.StrokeStyle) && Equals(FillStyle, other.FillStyle));
 }
示例#15
0
 protected bool Equals(ShapeStyle other)
 {
     return Equals(StrokeStyle, other.StrokeStyle) && Equals(FillStyle, other.FillStyle);
 }
示例#16
0
 public static Ellipse AddEllipse(this Canvas canvas, Rect rect, ShapeStyle shapeStyle)
 {
     return AddEllipse(canvas, rect.Left, rect.Top, rect.Width, rect.Height, shapeStyle);
 }
示例#17
0
 public static Ellipse AddEllipse(this Canvas canvas, Rect rect, ShapeStyle shapeStyle)
 {
     return(AddEllipse(canvas, rect.Left, rect.Top, rect.Width, rect.Height, shapeStyle));
 }
示例#18
0
        public static Line AddLine(this Canvas canvas, double x1, double y1, double x2, double y2, ShapeStyle shapeStyle)
        {
            Line line = new Line()
            {
                X1 = x1,
                Y1 = y1,
                X2 = x2,
                Y2 = y2
            };

            line.UpdateShape(shapeStyle);

            canvas.Children.Add(line);
            return(line);
        }
示例#19
0
        public static Polygon AddPolygon(this Canvas canvas, ShapeStyle shapeStyle, params Point[] points)
        {
            Polygon polygon = new Polygon();
            foreach (var point in points)
            {
                polygon.Points.Add(point);
            }
            polygon.UpdateShape(shapeStyle);

            canvas.Children.Add(polygon);
            return polygon;
        }
示例#20
0
 public static void UpdateShape(this Shape shape, ShapeStyle shapeStyle)
 {
     UpdateShape(shape, shapeStyle.StrokeStyle, shapeStyle.FillStyle);
 }