public override Shape Clone()
 {
     ShapeRectangle newShape = new ShapeRectangle();
     newShape.Location = new Point(this.Location.X + 15, this.Location.Y + 15);
     newShape.Size = this.Size;
     newShape.painter.CopyProperties(ref this.painter);
     return newShape;
 }
Beispiel #2
0
        public override Shape Clone()
        {
            ShapeRectangle newShape = new ShapeRectangle();

            newShape.Location = new Point(this.Location.X + 15, this.Location.Y + 15);
            newShape.Size     = this.Size;
            newShape.painter.CopyProperties(ref this.painter);
            return(newShape);
        }
        public void AddShape(byte intShapeID)
        {
            switch (intShapeID)
            {
            case 0:     //Rectangle
                ShapeRectangle rect = new ShapeRectangle();
                rect.Location = new Point(50, 50);
                AddShape(rect);
                break;

            case 1:     //Triangle
                ShapeTriangle triangle = new ShapeTriangle();
                triangle.Location = new Point(50, 50);
                AddShape(triangle);
                break;

            case 2:
                ShapeCircle circle = new ShapeCircle();
                circle.Location = new Point(50, 50);
                AddShape(circle);
                break;

            case 3:
                ShapePolygon poly = new ShapePolygon();
                poly.Location = new Point(50, 50);
                AddShape(poly);
                break;

            case 4:
                ShapeLine line = new ShapeLine();
                line.Location = new Point(50, 50);
                AddShape(line);
                break;

            case 5:
                ShapeText text = new ShapeText();
                text.Location = new Point(50, 50);
                AddShape(text);
                break;

            default:
                throw new Exception("Could not find the associated shape type!");
            }
        }
 public void AddShape(byte intShapeID)
 {
     switch (intShapeID)
     {
         case 0: //Rectangle
             ShapeRectangle rect = new ShapeRectangle();
             rect.Location = new Point(50, 50);
             AddShape(rect);
             break;
         case 1: //Triangle
             ShapeTriangle triangle = new ShapeTriangle();
             triangle.Location = new Point(50, 50);
             AddShape(triangle);
             break;
         case 2:
             ShapeCircle circle = new ShapeCircle();
             circle.Location = new Point(50, 50);
             AddShape(circle);
             break;
         case 3:
             ShapePolygon poly = new ShapePolygon();
             poly.Location = new Point(50, 50);
             AddShape(poly);
             break;
         case 4:
             ShapeLine line = new ShapeLine();
             line.Location = new Point(50, 50);
             AddShape(line);
             break;
         case 5:
             ShapeText text = new ShapeText();
             text.Location = new Point(50, 50);
             AddShape(text);
             break;
         default:
             throw new Exception("Could not find the associated shape type!");
     }
 }