您的位置:首页 > 其它

[转]CPoint+CSize+CRect学习大纲

2012-07-13 20:24 309 查看
CPoint+CSize+CRect学习大纲。

////////////////////////////////////////////////////////////////////////////////
熟知CPoint、CSize、CRect类的基类
class CPoint : public tagPOINT
class CSize : public tagSIZE
class CRect : public tagRECT

////////////////////////////////////////////////////////////////////////////////
留意CPoint、CSize、CRect之间的互操作,什么样的操作会涉及这些类型中的两个或多个。
Point - Point => Size
Point - Size => Point
Point - Rect => Rect
Point + Point => Point
Point + Size => Point
Point + Rect => Rect
Size - Point => Point
Size - Size
=> Size
Size - Rect
=> Rect
Size + Point => Point
Size + Size
=> Size
Size + Rect
=> Rect
Rect - Point => Rect
Rect - Size
=> Rect
Rect - Rect
=> Rect
Rect + Point => Rect
Rect + Size
=> Rect
Rect + Rect
=> Rect

////////////////////////////////////////////////////////////////////////////////
掌握CPoint类以下成员

// 数据
x
y
// 构造
CPoint
// 运算
Offset
operator –
operator +
operator +=
operator –=
// 比较
operator !=
operator ==

////////////////////////////////////////////////////////////////////////////////
掌握CSize类以下成员

// 数据
cx
cy
// 构造
CSize
// 运算
operator –
operator +
operator +=
operator –=
// 比较
operator !=
operator ==

////////////////////////////////////////////////////////////////////////////////
掌握CRect类以下成员

// 数据
left
top
right
bottom
// 构造
CRect
SetRect
CopyRect
// 属性
TopLeft
BottomRight
Width
Height
Size
CenterPoint
// 存在性
IsRectEmpty
SetRectEmpty
IsRectNull
// 比较
PtInRect
EqualRect
// 修改
MoveToX
MoveToY
MoveToXY
OffsetRect
InflateRect
DeflateRect
NormalizeRect
SubtractRect
IntersectRect
UnionRect
// 运算符
operator LPCRECT
operator LPRECT
operator =
operator !=
operator ==
operator –
operator +
operator &
operator |
operator +=
operator –=
operator &=
operator |=

////////////////////////////////////////////////////////////////////////////////
掌握CPoint、CSize、CRect之间的互操作,什么样的操作会涉及这些类型中的两个或多个。
Point - Point => Size
Point - Size => Point
Point - Rect => Rect
Point + Point => Point
Point + Size => Point
Point + Rect => Rect
Size - Point => Point
Size - Size
=> Size
Size - Rect
=> Rect
Size + Point => Point
Size + Size
=> Size
Size + Rect
=> Rect
Rect - Point => Rect
Rect - Size
=> Rect
Rect - Rect
=> Rect
Rect + Point => Rect
Rect + Size
=> Rect
Rect + Rect
=> Rect
* 加法满足交换律
* 运算不可以移项
* 与Rect有交的运算都产生Rect
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: