예제 #1
0
        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!");
            }
        }
예제 #2
0
 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!");
     }
 }