Region.IsVisible方法

简单方便准确

private bool CheckPntInPoly(Point[] points, Point pnt)

        {

            if (points == null || points.Length ==  || 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);

        }
05-02 09:52