Ejemplo n.º 1
0
 public override Object Clone()
 {
     var result = new PolygonProperty();
     result.InitProperty();
     Copy(result);
     return result;
 }
Ejemplo n.º 2
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;
         }
     }
 }
Ejemplo n.º 3
0
 public DrawPolygon(PolygonProperty property)
     : base(property)
 {
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Right mouse button is released
 /// </summary>
 /// <param name="drawArea"></param>
 /// <param name="e"></param>
 public override void OnRightMouseUp(IToolDrawArea drawArea, MouseEventArgs e)
 {
     property = null;
     draw = null;
     base.OnMouseUp(drawArea, e);
 }
Ejemplo n.º 5
0
 public override IDrawObject CreateDrawObject(PageControl control)
 {
     var property = new PolygonProperty();
     InitDrawObjectFromPageControl(control, property);
     return new DrawPolygon(property);
 }