private void DrawGraphic(Context currentGraphic, Graphics g) { List<Point> graphicPoints = currentGraphic.ExecuteOperation(panel1.Height, panel1.Width); for (int i = 0; i < graphicPoints.Count - 1; i++) { Point prevPoint = new Point(graphicPoints[i]); g.DrawLine(graphPen, prevPoint.X, prevPoint.Y, graphicPoints[i + 1].X, graphicPoints[i + 1].Y); } }
private void panel1_Paint(object sender, PaintEventArgs e) { Graphics g = panel1.CreateGraphics(); Context currentGraphic = new Context(new GraphicEmpty()); switch(comboBox1.SelectedIndex) { case 0: // Кардиоида currentGraphic.SetGraphic(new GraphicCardioid()); break; case 1: // Строфоида currentGraphic.SetGraphic(new GraphicStrophoid()); break; case 2: // Циссоида Диокла currentGraphic.SetGraphic(new GraphicDiocalCissoid()); break; case 3: // Декартов лист currentGraphic.SetGraphic(new GraphicDecartLeaf()); break; case 4: // Верзьера Аньези currentGraphic.SetGraphic(new GraphicAniezyVerziery()); break; case 5: // Конхоида Никомеда currentGraphic.SetGraphic(new GraphicNicomedKonkhoid()); break; default: break; } DrawAxeses(g); DrawGraphic(currentGraphic, g); DrawAxeses(g); }