Exemplo n.º 1
0
        /// <summary>
        /// Mouse move - resize new polygon
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public override void OnMouseMove(IToolDrawArea drawArea, MouseEventArgs e)
        {
            drawArea.Control.Cursor = BoxCursor;

            if (e.Button != MouseButtons.Left)
                return;

            if (draw == null)
                return;                 // precaution

            var point = new Point(e.X, e.Y);
            int distance = (e.X - lastX) * (e.X - lastX) + (e.Y - lastY) * (e.Y - lastY);

            if (distance < minDistance)
            {
                // Distance between last two points is less than minimum -
                // move last point
                draw.MoveHandleTo(point, draw.HandleCount);
            }
            else
            {
                // Add new point
                (draw.Property as PencilProperty).AddPoint(point);
                lastX = e.X;
                lastY = e.Y;
            }

            drawArea.RefreshToolDrawArea();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Mouse move - resize new polygon
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public override void OnMouseMove(IToolDrawArea drawArea, MouseEventArgs e)
        {
            drawArea.Control.Cursor = BoxCursor;

            if (draw == null)
                return;

            if (e.Button != MouseButtons.Left)
                return;

            drawArea.RefreshToolDrawArea();
        }