CRgn类的行为 [英] Behaviour of CRgn class

查看:138
本文介绍了CRgn类的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

Hi All,

CPoint ptArray[5];
ptArray[0] = CPoint(657, 79);
ptArray[1] = CPoint(675, 71);
ptArray[2] = CPoint(694, 66);
ptArray[3] = CPoint(912, 64);
ptArray[4] = CPoint(792, 66);
CRgn rgnObject;
rgnObject.CreatePolygonRgn(ptArray, 5, ALTERNATE);
CRect rectBounding;
rgnObject.GetRgnBox(rectBounding);



对于边界rect,我期望left = 657,right = 912,top = 64 and bottom 79,即最小和最大X和Y坐标.
实际结果为左= 660,右= 852,顶部= 65,底部79

谁能解释一下?

在此先感谢.



For bounding rect, I was expecting left = 657, right = 912, top = 64 and bottom 79 i.e. minimum and maximum X and Y coordinates.
Actual results are left = 660, right = 852, top = 65 and bottom 79

Can anyone explain this?

Thanks in advance.

推荐答案

边界矩形实际上界定了该区域,但是,定义该区域的某些点(第一,第四和第五个)区域实际上不在区域本身之内(您可以使用PtInRegion方法进行验证).我认为这与区域计算中发生的舍入有关.
The bounding rectangle actually bounds the region, however, some points (the first, fourth and fifth) defining the region actually aren''t inside the region itself (you may verify this using the PtInRegion method). I think this is related to roundings happening in region calculation.


该解决方案应该由可用的方法CRgn::PtInRegion实现,请参见http://msdn.microsoft.com/en-us/library/07zzbzfh(v=VS.71).aspx [ ^ ].

—SA
The solution is supposed to be implemented by the available method CRgn::PtInRegion, see http://msdn.microsoft.com/en-us/library/07zzbzfh(v=VS.71).aspx[^].

—SA


这篇关于CRgn类的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆