CPoint::operator -

CSize operator -( POINT point ) const;

CPoint operator -( SIZE size ) const;

CRect operator -( const RECT* lpRect ) const;

CPoint operator -( ) const;

Return Value

A CSize that is the difference between two points, a CPoint that is offset by the negation of a  size, a CRect that is offset by the negation of a point, or a CPoint that is the negation of a point.

Parameters

point

A POINT structure or CPoint object.

size

A SIZE structure or CSize object.

lpRect

A pointer to a RECT structure or a CRect object.

Remarks

Use one of the first two overloads to subtract a CPoint or CSize object from CPoint. The third overload offsets a CRect by the negation of CPoint. Finally, use the unary operator to negate CPoint.

For example, using the first overload to find the difference between two points CPoint(25, -19) and CPoint(15, 5) returns CSize(10, -24).

Subtracting a CSize from CPoint does the same calculation as above but returns a CPoint object, not a CSize object. For example, using the second overload to find the difference between the point
CPoint(25, -19) and the size CSize(15, 5) returns
CPoint(10, -24).

Subtracting a rectangle from a point returns the rectangle offset by the negatives of the x and y values specified in the point. For example, using the last overload to offset the rectangle CRect(125, 200, 325, 400) by the point CPoint(25, -19) returns
CRect(100, 219, 300, 419).

Use the unary operator to negate a point. For example, using the unary operator with the point CPoint(25, -19) returns CPoint(-25, 19).

CPoint OverviewClass MembersHierarchy Chart

See Also   CPoint::operator –=, CPoint::operator +=, CPoint::operator +, CSize::operator -, CRect::operator -, CPoint::Offset, CRect::OffsetRect