Microsoft Foundation Classes (mfc.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
class CRect
◄Up► ◄Contents► ◄Index► ◄Back►
──Microsoft Foundation Classes──────────────────────────────────────────────
Description
The CRect class is similar to a Windows RECT structure, and also
includes member functions to manipulate a CRect and Windows RECT
structures.
A CRect object can be passed as a function parameter wherever a LPRECT
or RECT structure can be passed.
A CRect contains member variables that define the top-left and
bottom-right points of a rectangle. The width or height of the rectangle
defined by CRect must not exceed 32,767 units.
When specifying a CRect, you must be careful to construct it so that the
top-left point is above and to the left of the bottom-right point in the
Windows coordinate system; otherwise, the CRect will not be recognized
by some functions. For example, a top left of (10,10) and bottom right
of (20,20) defines a valid rectangle; a top left of (20,20) and bottom
right of (10,10), an invalid rectangle.
When using overloaded CRect operators, the first operator must be a
CRect; the second can be either a RECT or a CRect.
See Also
◄CPoint►, ◄CSize►
Public Members
Construction/Destruction
◄CRect► Constructs a CRect object.
Operations
◄Width► Calculates the width of CRect.
◄Height► Calculates the height of CRect.
◄Size► Calculates the size of CRect.
◄TopLeft► Returns a reference to the top-left point of CRect.
◄BottomRight► Returns a reference to the bottom-right point of
CRect.
◄IsRectEmpty► Determines whether CRect is empty. CRect is empty if
the width and/or height are 0.
◄IsRectNull► Determines if the top, bottom, left, and right member
variables are all equal to 0.
◄PtInRect► Determines whether the specified point lies within
CRect.
◄SetRect► Sets the dimensions of CRect.
◄SetRectEmpty► Sets CRect to an empty rectangle (all coordinates
equal to 0).
◄CopyRect► Copies the dimensions of a source rectangle to CRect.
◄EqualRect► Determines whether CRect is equal to the given
rectangle.
◄InflateRect► Increases or decreases the width and height of CRect.
◄OffsetRect► Moves CRect by the specified offsets.
◄IntersectRect► Sets CRect equal to the intersection of two
rectangles.
◄UnionRect► Sets CRect equal to the union of two rectangles.
Operators
◄operator LPRECT► Converts a CRect to an LPRECT.
◄operator =► Copies the dimensions of a rectangle to CRect.
◄operator ==► Determines whether CRect is equal to a rectangle.
◄operator !=► Determines whether CRect is not equal to a
rectangle.
◄operator +=► Adds the specified offsets to CRect.
◄operator -=► Subtracts the specified offsets from CRect.
◄operator &=► Sets CRect equal to the intersection of CRect and a
rectangle.
◄operator |=► Sets CRect equal to the union of CRect and a
rectangle.
◄operator +► Adds the given offsets to CRect and returns the
resulting CRect.
◄operator -► Subtracts the given offsets from CRect and returns
the resulting CRect.
◄operator &► Creates the intersection of CRect and a rectangle,
and returns the resulting CRect.
◄operator |► Creates the union of CRect and a rectangle, and
returns the resulting CRect.
Windows 3.1 Funtions
◄SubtractRect► Subtracts one rectangle from another.
-♦-