Example #1
0
        public void HighlightSelectedFigure(AFigure aFigure)

        {
            if (aFigure != null)
            {
                List <Point> points = aFigure.DoFigureMath();
                if (points.Count > 50)
                {
                    if (points.Count == 360)     // круг
                    {
                        for (int i = 0; i < points.Count; i = i + 45)
                        {
                            if (i == 0 || i == 90 || i == 180 || i == 270 || i == 360)
                            {
                            }
                            else
                            {
                                DrawLine(points[i], points[i], 7, Color.Red);
                            }
                        }
                    }
                    else
                    {
                        Point        first       = aFigure.ReturnPoints()[0];
                        Point        second      = aFigure.ReturnPoints()[1];
                        List <Point> focusPoints = new MathEllipse().FindFocusPoints(first, second);
                        Point        right       = focusPoints[1];
                        Point        left        = focusPoints[2];
                        Point        top         = focusPoints[3];
                        Point        bottom      = focusPoints[4];
                        DrawLine(right, right, 7, Color.Red);
                        DrawLine(left, left, 7, Color.Red);
                        DrawLine(top, top, 7, Color.Red);
                        DrawLine(bottom, bottom, 7, Color.Red);
                    }
                }
                else
                {
                    for (int i = 0; i < points.Count; i++)
                    {
                        DrawLine(points[i], points[i], 7, Color.Red);
                    }
                }
            }
        }