Пример #1
0
 /// <summary>
 /// Left nouse button is pressed
 /// </summary>
 /// <param name="drawArea"></param>
 /// <param name="e"></param>
 public override void OnMouseDown(DrawArea drawArea, MouseEventArgs e)
 {
     if (e.Button ==
         MouseButtons.Right)
     {
         _drawingInProcess = false;
         newPolyLine = null;
     }
     else
     {
         Point p = drawArea.BackTrackMouse(new Point(e.X, e.Y));
         if (drawArea.PenType ==
             DrawingPens.PenType.Generic)
         {
             if (_drawingInProcess == false)
             {
                 newPolyLine = new DrawPolyLine(p.X, p.Y, p.X + 1, p.Y + 1, drawArea.LineColor, drawArea.LineWidth);
                 newPolyLine.EndPoint = new Point(p.X + 1, p.Y + 1);
                 AddNewObject(drawArea, newPolyLine);
                 _drawingInProcess = true;
             }
             else
             {
                 // Drawing is in process, so simply add a new point
                 newPolyLine.AddPoint(p);
                 newPolyLine.EndPoint = p;
             }
         }
         else
         {
             if (_drawingInProcess == false)
             {
                 newPolyLine = new DrawPolyLine(p.X, p.Y, p.X + 1, p.Y + 1, drawArea.PenType);
                 newPolyLine.EndPoint = new Point(p.X + 1, p.Y + 1);
                 AddNewObject(drawArea, newPolyLine);
                 _drawingInProcess = true;
             }
             else
             {
                 // Drawing is in process, so simply add a new point
                 newPolyLine.AddPoint(p);
                 newPolyLine.EndPoint = p;
             }
         }
     }
 }
Пример #2
0
        /// <summary>
        /// Clone this instance
        /// </summary>
        public override DrawObject Clone()
        {
            DrawPolyLine drawPolyLine = new DrawPolyLine();

            drawPolyLine.startPoint = startPoint;
            drawPolyLine.endPoint = endPoint;
            drawPolyLine.pointArray = pointArray;

            FillDrawObjectFields(drawPolyLine);
            return drawPolyLine;
        }