Exemplo n.º 1
0
        /// <summary>
        ///  Конструктор класса обработчика для эллипса
        /// </summary>
        /// <param name="canvas">Канва</param>
        /// <param name="figureParameters">Параметры</param>
        public EllipseHandler(PictureBox canvas, FigureParameters figureParameters)
        {
            FigureParameters = figureParameters;
            Canvas           = canvas;

            _ellipse = null;

            MouseDownDelegate += MouseDown;
            MouseUpDelegate   += MouseUp;
            MouseMoveDelegate += MouseMove;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Конструктор класса обработчика для полигона
        /// </summary>
        /// <param name="canvas">Канва</param>
        /// <param name="figureParameters">Параметры фигуры</param>
        public PolygonHandler(PictureBox canvas, FigureParameters figureParameters)
        {
            FigureParameters = figureParameters;
            Canvas           = canvas;

            _polygon = null;

            MouseDownDelegate += MouseDown;
            MouseUpDelegate   += MouseUp;
            MouseMoveDelegate += MouseMove;
        }
Exemplo n.º 3
0
        /// <inheritdoc />
        /// <summary>
        /// Изменения параметров фигуры
        /// </summary>
        /// <param name="index">Индекс фигуры, у которой менятся параметры</param>
        /// <param name="newParameters">Новые параметрвы</param>
        public void ChangeFigureParameters(int index, FigureParameters newParameters)
        {
            var figure = _figures[index];

            figure.LineProperties.Color     = newParameters.LineColor;
            figure.LineProperties.Style     = (DashStyle)newParameters.LineStyle;
            figure.LineProperties.Thickness = newParameters.LineThickness;
            if (figure.GetType() == typeof(Circle) ||
                figure.GetType() == typeof(Ellipse) ||
                figure.GetType() == typeof(Polygon))
            {
                var tempFigure = figure as FillableFigure;
                if (tempFigure != null)
                {
                    tempFigure.FillProperty.FillColor = newParameters.FillColor;
                }
            }
            HasChanged();
            NotifyObservers();
        }