Example #1
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);
        }
Example #2
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;
        }