Пример #1
0
        private void createCurrentShape()
        {
            switch (drawing)
            {
            case CurrentDrawing.Ellipse:
                Ellipse ellipse = new Ellipse();
                ellipse.setFillColor(this.currentFillColor);
                ellipse.setBorderColor(this.currentBorderColor);
                this.shape = ellipse;
                break;

            case CurrentDrawing.Circle:
                Circle circle = new Circle();
                circle.setFillColor(this.currentFillColor);
                circle.setBorderColor(this.currentBorderColor);
                this.shape = circle;
                break;

            case CurrentDrawing.Line:
                Shape line = new Line();
                line.setBorderColor(this.currentBorderColor);
                this.shape = line;
                break;

            case CurrentDrawing.Ray:
                Shape ray = new Ray();
                ray.setBorderColor(this.currentBorderColor);
                this.shape = ray;
                break;

            case CurrentDrawing.LineSegment:
                Shape lineSegment = new LineSegment();
                lineSegment.setBorderColor(this.currentBorderColor);
                this.shape = lineSegment;
                break;

            case CurrentDrawing.Poligon:
                Poligon poligon = new Poligon();
                poligon.setFillColor(this.currentFillColor);
                poligon.setBorderColor(this.currentBorderColor);
                this.shape = poligon;
                break;

            case CurrentDrawing.RegularPolygon:
                RegularPolygon regularPoligon = new RegularPolygon((int)this.numericUpDown1.Value);
                regularPoligon.setFillColor(this.currentFillColor);
                regularPoligon.setBorderColor(this.currentBorderColor);
                this.shape = regularPoligon;
                break;

            case CurrentDrawing.RightTriangle:
                RightTriangle rightTriangle = new RightTriangle();
                rightTriangle.setFillColor(this.currentFillColor);
                rightTriangle.setBorderColor(this.currentBorderColor);
                this.shape = rightTriangle;
                break;

            case CurrentDrawing.IsoscelesTriangle:
                IsoscelesTriangle isoscelesTriangle = new IsoscelesTriangle();
                isoscelesTriangle.setFillColor(this.currentFillColor);
                isoscelesTriangle.setBorderColor(this.currentBorderColor);
                this.shape = isoscelesTriangle;
                break;

            case CurrentDrawing.Parallelogram:
                Parallelogram parallelogram = new Parallelogram();
                parallelogram.setFillColor(this.currentFillColor);
                parallelogram.setBorderColor(this.currentBorderColor);
                this.shape = parallelogram;
                break;

            case CurrentDrawing.Rectangle:
                Rectangle rectangle = new Rectangle();
                rectangle.setFillColor(this.currentFillColor);
                rectangle.setBorderColor(this.currentBorderColor);
                this.shape = rectangle;
                break;

            case CurrentDrawing.Rhomb:
                Rhomb rhomb = new Rhomb();
                rhomb.setFillColor(this.currentFillColor);
                rhomb.setBorderColor(this.currentBorderColor);
                this.shape = rhomb;
                break;
            }
        }