/// <summary> Добавить фигуру на поле </summary> private void ButtonAddFigure_Click(object sender, System.EventArgs e) { List <PointF> pointsFigure = helpers.GetPointsFromString(TextBoxPointsFigure.Text); if (pointsFigure == null) { MessageBox.Show("Координаты фигуры не коректны"); return; } IFigure figure = new Figure(PictureBoxFigureColorBody.BackColor, pointsFigure); game.AddFigure(figure); ListBoxFigures.Items.Add("Фигура №" + (ListBoxFigures.Items.Count + 1) + " [" + figure.GetPoints().Count + "-x угольник]"); ListBoxFigures.ClearSelected(); ListBoxFigures.SelectedIndex = ListBoxFigures.Items.Count - 1; // выбираем последнюю добавленную RenderAll(); }