类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
"球"助:怎么才能知道一个点是否在矩形,圆形,多边形内呢?
网友回答:
这个有难度,帮你想想!
矩形,圆形还好说 多边形。。。
PtInRegion试试
你可以写个函数判断
如果图形是矩形,则判断其是否在四个顶点之间
圆形则判断是否距离圆心超过半径
当然多边形就比较麻烦了
//多边形实现可以参考下面2个API
//创建一个多边形区域
HRGN CreatePolygonRgn(
CONST POINT *lppt, // pointer to array of points
int cPoints, // number of points in array
int fnPolyFillMode // polygon-filling mode
);
//判断一个指定的坐标是否位于一个区域内
BOOL PtInRegion(
HRGN hrgn, // handle of region
int X, // x-coordinate of point
int Y // y-coordinate of point
);
同意,用PtInRegion试试