Пример #1
0
        public void Paste()
        {
            foreach (var item in CopyData.ToList())
            {
                if (item.GetType() == typeof(RectangleShape))
                {
                    RectangleShape rect = new RectangleShape(new Rectangle((int)item.Location.X + 200, (int)item.Location.Y, 100, 200))
                    {
                        BorderColor = item.BorderColor,
                        FillColor   = item.FillColor,
                        Height      = item.Height,
                        Width       = item.Width,
                        Rotation    = item.Rotation
                    };
                    ShapeList.Add(rect);
                }

                else if (item.GetType() == typeof(EllipseShape))
                {
                    EllipseShape ellipse = new EllipseShape(new Rectangle((int)item.Location.X + 200, (int)item.Location.Y, 100, 200))
                    {
                        BorderColor = item.BorderColor,
                        FillColor   = item.FillColor,
                        Height      = item.Height,
                        Width       = item.Width,
                        Rotation    = item.Rotation
                    };
                    ShapeList.Add(ellipse);
                }

                else if (item.GetType() == typeof(TriangleShape))
                {
                    TriangleShape triangle = new TriangleShape(new Rectangle((int)item.Location.X + 200, (int)item.Location.Y, 100, 200))
                    {
                        PercentX       = item.PercentX,
                        PercentY       = item.PercentY,
                        IsBeingResized = item.IsBeingResized,
                        Point1         = item.Point1,
                        Point2         = item.Point2,

                        x1 = item.x1,
                        x2 = item.x2,
                        x3 = item.x3,
                        y1 = item.y1,
                        y2 = item.y2,
                        y3 = item.y3,

                        Polygon      = item.Polygon,
                        TriangleSize = item.TriangleSize,
                        BorderColor  = item.BorderColor,
                        FillColor    = item.FillColor,
                        Height       = item.Height,
                        Width        = item.Width,
                        Rotation     = item.Rotation
                    };
                    ShapeList.Add(triangle);
                }

                else if (item.GetType() == typeof(LineShape))
                {
                    LineShape line = new LineShape(new Rectangle((int)item.Location.X + 200, (int)item.Location.Y, 100, 200))
                    {
                        x1             = item.x2,
                        x2             = item.x2,
                        y1             = item.y1,
                        y2             = item.y2,
                        LineSize       = item.LineSize,
                        Point1         = item.Point1,
                        Point2         = item.Point2,
                        IsBeingResized = item.IsBeingResized,
                        Polygon        = item.Polygon,
                        TriangleSize   = item.TriangleSize,
                        BorderColor    = item.BorderColor,
                        FillColor      = item.FillColor,
                        Height         = item.Height,
                        Width          = item.Width,
                        Rotation       = item.Rotation
                    };
                    ShapeList.Add(line);
                }

                else if (item.GetType() == typeof(TrapezoidShape))
                {
                    TrapezoidShape trape = new TrapezoidShape(new Rectangle((int)item.Location.X + 200, (int)item.Location.Y, 100, 200))
                    {
                        LineSize     = item.LineSize,
                        Polygon      = item.Polygon,
                        TriangleSize = item.TriangleSize,
                        BorderColor  = item.BorderColor,
                        FillColor    = item.FillColor,
                        Height       = item.Height,
                        Width        = item.Width,
                        Rotation     = item.Rotation
                    };
                    ShapeList.Add(trape);
                }
            }
        }