コード例 #1
0
 /// <summary>
 /// 判断一个点是否在一个元素上,即用来判断是否选中贝塞尔曲线
 /// </summary>
 public bool PointInObject(ICanvas canvas, UnitPoint point)
 {
     try
     {
         //RectangleF boundingrect = GetBoundingRect(canvas);
         //if (boundingrect.Contains(point.Point) == false)
         //    return false;
         //else
         //{ return true; }
         PointF[] pointList = new PointF[] { P1.Point, P4.Point, P3.Point, P2.Point };
         PointF[] aa        = HitUtil.draw_bezier_curves(pointList, pointList.Length, 0.001F); // 在起点和终点之间
         if (aa.Count(p => Math.Abs(p.X - point.Point.X) <= 0.05 && Math.Abs(p.Y - point.Point.Y) <= 0.05) > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     { throw ex; }
 }