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);         

        }

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-25
  • 2022-12-23
  • 2021-11-29
  • 2022-01-26
猜你喜欢
  • 2022-12-23
  • 2022-02-19
  • 2022-12-23
  • 2021-11-11
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
相关资源
相似解决方案