Beispiel #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);
        }
Beispiel #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;
        }
Beispiel #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;
        }
Beispiel #4
0
 public static Ellipse AddEllipse(this Canvas canvas, Point point, Size size, ShapeStyle shapeStyle)
 {
     return AddEllipse(canvas, new Rect(point, size), shapeStyle);
 }
Beispiel #5
0
 public static Rectangle AddRectangle(this Canvas canvas, Point point, Size size, ShapeStyle shapeStyle)
 {
     return AddRectangle(canvas, new Rect(point, size), shapeStyle);
 }
Beispiel #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;
        }
Beispiel #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;
        }
Beispiel #8
0
 public static void UpdateShape(this Shape shape, ShapeStyle shapeStyle)
 {
     UpdateShape(shape, shapeStyle.StrokeStyle, shapeStyle.FillStyle);
 }
Beispiel #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);
 }
Beispiel #10
0
 public static Ellipse AddEllipse(this Canvas canvas, Point point, Size size, ShapeStyle shapeStyle)
 {
     return(AddEllipse(canvas, new Rect(point, size), shapeStyle));
 }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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));
 }
Beispiel #14
0
 protected bool Equals(ShapeStyle other)
 {
     return(Equals(StrokeStyle, other.StrokeStyle) && Equals(FillStyle, other.FillStyle));
 }
Beispiel #15
0
 protected bool Equals(ShapeStyle other)
 {
     return Equals(StrokeStyle, other.StrokeStyle) && Equals(FillStyle, other.FillStyle);
 }
Beispiel #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);
 }
Beispiel #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));
 }
Beispiel #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);
        }
Beispiel #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;
        }
Beispiel #20
0
 public static void UpdateShape(this Shape shape, ShapeStyle shapeStyle)
 {
     UpdateShape(shape, shapeStyle.StrokeStyle, shapeStyle.FillStyle);
 }