Example #1
0
 /// <summary>
 /// Left nouse button is pressed
 /// </summary>
 /// <param name="drawArea"></param>
 /// <param name="e"></param>
 public override void OnMouseDown(IToolDrawArea drawArea, MouseEventArgs e)
 {
     if (draw == null)
     {
         property = new PolygonProperty();
         property.InitProperty();
         property.AddPoint(new Point(e.X, e.Y));
         property.AddPoint(new Point(e.X + 1, e.Y + 1));
         draw = new DrawPolygon(property);
         drawArea.AddNewDrawObject(draw);
         lastX = e.X;
         lastY = e.Y;
     }
     else
     {
         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)
         {
             draw.MoveHandleTo(point, draw.HandleCount);
         }
         else
         {
             property.AddPoint(point);
             lastX = e.X;
             lastY = e.Y;
         }
     }
 }
Example #2
0
 public override void OnMouseDown(IToolDrawArea drawArea, MouseEventArgs e)
 {
     var property = new LineProperty();
     property.InitProperty();
     property.Start = String.Format("{0},{1}", e.X, e.Y);
     property.End = String.Format("{0},{1}", e.X + 1, e.Y + 1);
     var draw = new DrawLine(property);
     drawArea.AddNewDrawObject(draw);
 }
Example #3
0
 public override void OnMouseDown(IToolDrawArea drawArea, MouseEventArgs e)
 {
     var property = new LabelProperty();
     property.InitProperty();
     property.Size = "1,1";
     property.Location = String.Format("{0},{1}", e.X, e.Y);
     var draw = new DrawLabel(property);
     drawArea.AddNewDrawObject(draw);
 }
Example #4
0
 /// <summary>
 /// Left nouse button is pressed
 /// </summary>
 /// <param name="drawArea"></param>
 /// <param name="e"></param>
 public override void OnMouseDown(IToolDrawArea drawArea, MouseEventArgs e)
 {
     var property = new PencilProperty();
     property.InitProperty();
     property.AddPoint(new Point(e.X, e.Y));
     property.AddPoint(new Point(e.X + 1, e.Y + 1));
     draw = new DrawPencil(property);
     drawArea.AddNewDrawObject(draw);
     lastX = e.X;
     lastY = e.Y;
 }