求教关于一个CRect类型转换的问题
1个回答
展开全部
MFC不会使用
1.重载了operator+=函数。
rc+=CRect(10,0,-10,0);MFC实现是这样的顺序
构造
ATLTYPES_INLINE CRect::CRect(int l, int t, int r, int b) throw()
{ left = l; top = t; right = r; bottom = b; }
转换
ATLTYPES_INLINE CRect::operator LPRECT() throw()
{ return this; }
ATLTYPES_INLINE void CRect::operator+=(LPCRECT lpRect) throw()
{ InflateRect(lpRect); }
ATLTYPES_INLINE void CRect::InflateRect(LPCRECT lpRect) throw()
{
left -= lpRect->left; top -= lpRect->top;
right += lpRect->right; bottom += lpRect->bottom;
}
看看这个operator+=是怎么计算的
1.重载了operator+=函数。
rc+=CRect(10,0,-10,0);MFC实现是这样的顺序
构造
ATLTYPES_INLINE CRect::CRect(int l, int t, int r, int b) throw()
{ left = l; top = t; right = r; bottom = b; }
转换
ATLTYPES_INLINE CRect::operator LPRECT() throw()
{ return this; }
ATLTYPES_INLINE void CRect::operator+=(LPCRECT lpRect) throw()
{ InflateRect(lpRect); }
ATLTYPES_INLINE void CRect::InflateRect(LPCRECT lpRect) throw()
{
left -= lpRect->left; top -= lpRect->top;
right += lpRect->right; bottom += lpRect->bottom;
}
看看这个operator+=是怎么计算的
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询