private void CreateTrapezium() { Color randomColor = Color.FromKnownColor(GetRandomColor()); Trapezium trapezium = new Trapezium(this, randomColor, starterCenterX, starterCenterY); trapezium.DrawFigure(); figuresList.Add(trapezium); starterCenterX += 50; }
static void Main(string[] args) { Menu menuFigures = new Menu(9); Menu menuCalcTarget = new Menu(3); Menu menuNewCalc = new Menu(2); SetMenuFigures(ref menuFigures); SetMenuCalcTarget(ref menuCalcTarget); SetMenuNewCalc(ref menuNewCalc); do { int n; n = CorrectInput("Введите количество фигур (не больше {0}): --->"); if (n != 0) { ComplexFigure figures = new ComplexFigure(n); Clear(); for (int i = 0; i < n; i++) { TypeFigures typeFigures = (TypeFigures)menuFigures.SelectOption("Выбор {0}-ой фигуры:", i); switch (typeFigures) { case TypeFigures.Triangle: figures[i] = new Triangle(); break; case TypeFigures.Rhomb: figures[i] = new Rhomb(); break; case TypeFigures.Quadrate: figures[i] = new Quadrate(); break; case TypeFigures.Parallelogram: figures[i] = new Parallelogram(); break; case TypeFigures.Rectangle: figures[i] = new Rectangle(); break; case TypeFigures.Trapezium: figures[i] = new Trapezium(); break; case TypeFigures.Ellipse: figures[i] = new Ellipse(); break; case TypeFigures.Circle: figures[i] = new Circle(); break; case TypeFigures.Undefined: figures = null; break; } if (typeFigures != TypeFigures.Undefined) { WriteLine("************ Выбрана фигура: {0}. ", figures[i].NameFigure); figures[i].InputData(); WriteLine(figures[i]); figures[i].Draw(CursorLeft, CursorTop, ConsoleColor.Blue); } } if (n != 1) { WriteLine("************ Составная фигура включает в себя : "); foreach (IPoligon figure in figures) //for (int j = 0; j < n; j++) { WriteLine(figure); figure.Draw(CursorLeft, CursorTop, ConsoleColor.Blue); } WriteLine("************ Площадь и периметр составной фигуры: "); WriteLine(figures); } ResetColor(); figures = null; } } while (menuNewCalc.SelectOption("Выбор дальнейшего действия:") == 1); }