Example #1
0
        /// <summary>
        /// 重写基类的方法,由于直线是线段,其上的点是否被矩形包含需要特殊处理
        /// </summary>
        public override bool AnyPointContainedByRect(Rectangle rect)
        {
            PointF[] pf      = VertexAnchors;
            Point    linePt1 = new Point((int)pf[0].X, (int)pf[0].Y);
            Point    linePt2 = new Point((int)pf[1].X, (int)pf[1].Y);

            return(GeometricHelper.RectContainsPointOnLine(rect, linePt1, linePt2));
        }
Example #2
0
 public override bool AnyPointContainedByRect(Rectangle rect)
 {
     PointF[] pf = Path.PathPoints;
     for (int i = 0; i < pf.Length - 1; i++)
     {
         Point linePt1 = new Point((int)pf[i].X, (int)pf[i].Y);
         Point linePt2 = new Point((int)pf[i + 1].X, (int)pf[i + 1].Y);
         if (GeometricHelper.RectContainsPointOnLine(rect, linePt1, linePt2))
         {
             return(true);
         }
     }
     return(false);
 }