判断点是否在多边形内

利用Region.IsVisible方法

示例代码:

Point[] points2 = { new Point(15, 15), new Point(90, 20), new Point(130, 160), new Point(60, 160), new Point(5, 80) };
GraphicsPath path = new GraphicsPath();
path.AddPolygon(points2);
path.CloseFigure();
Region region = new Region(path);
Point point = new Point(10, 10);
if (region.IsVisible(point))

 

此方法对于点在区域边界的情况,判断是在区域外。

posted @ 2012-11-16 10:57  woaibaojinyuan  阅读(130)  评论(0编辑  收藏  举报