PtInRect 失效的解决

来源:互联网 发布:java中md5 32 编辑:程序博客网 时间:2024/04/29 15:52

PtInRect 中出现错误,当rect中出现负值,就罢工了。

看了一下msdn

 

PtInRect

 

Note

The rectangle must be normalized or this function may fail. You can call NormalizeRect to normalize the rectangle before calling this function.

 

The rectangle is normalized for fourth-quadrant positioning, which Windows typically uses for coordinates. NormalizeRect compares the top and bottom values, and swaps them if the top is greater than the bottom. Similarly, it swaps the left and right values if the left is greater than the right. This function is useful when dealing with different mapping modes and inverted rectangles.

 

如上分析,NormalizeRect就是把数据进行规整化。

调用这个函数后,PtInRect 就可以正常工作了

原创粉丝点击