Region.IsVisible方法
簡單友善準确
private bool CheckPntInPoly(Point[] points, Point pnt)
{
if (points == null || points.Length == 0 || pnt == Point.Empty)
{
return false;
}
System.Drawing.Drawing2D.GraphicsPath myGraphicsPath=newSystem.Drawing.Drawing2D.GraphicsPath();
Region myRegion=new Region();
myGraphicsPath.Reset();
myGraphicsPath.AddPolygon(points);
myRegion.MakeEmpty();
myRegion.Union(myGraphicsPath);
//傳回判斷點是否在多邊形裡
return myRegion.IsVisible(pnt);
}