//OnClick button events for basic shapes END //Handles the situation when different shapes from already drawn shapes list are chosen private void ShapeListBox_SelectedIndexChanged(object sender, EventArgs e) { if (ShapeListBox.SelectedIndex != -1) { changeBtn.Enabled = true; deleteBtn.Enabled = true; Shape S = DrawnShapesList.GetShape(ShapeListBox.SelectedIndex); Invalidate(); Update(); g = CreateGraphics(); //Because of the way this triangle is drawn the select triangle around it doesn't display correctly, this "if" fixes it. if (S.EngName == "Triangle") { MRectangle.Make(Color.Purple, 2, new PenStyle("Dash", "Штрих", System.Drawing.Drawing2D.DashStyle.DashDot), S.getX2(), S.getY2(), 2 * S.getX1() - S.getX2(), S.getY1()).draw(g); } else { MRectangle.Make(Color.Purple, 2, new PenStyle("Dash", "Штрих", System.Drawing.Drawing2D.DashStyle.DashDot), S.getX1(), S.getY1(), S.getX2(), S.getY2()).draw(g); } } else { Invalidate(); } }