description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: CSize Class |
CSize Class |
10/18/2018 |
|
|
fb2cf85a-0bc1-46f8-892b-309c108b52ae |
Similar to the Windows SIZE structure, which implements a relative coordinate or position.
class CSize : public tagSIZE
Name | Description |
---|---|
CSize::CSize | Constructs a CSize object. |
Name | Description |
---|---|
CSize::operator - | Subtracts two sizes. |
CSize::operator != | Checks for inequality between CSize and a size. |
CSize::operator + | Adds two sizes. |
CSize::operator += | Adds a size to CSize . |
CSize::operator -= | Subtracts a size from CSize . |
CSize::operator == | Checks for equality between CSize and a size. |
This class is derived from the SIZE
structure. This means you can pass a CSize
in a parameter that calls for a SIZE
and that the data members of the SIZE
structure are accessible data members of CSize
.
The cx
and cy
members of SIZE
(and CSize
) are public. In addition, CSize
implements member functions to manipulate the SIZE
structure.
Note
For more information on shared utility classes (like CSize
), see Shared Classes.
tagSIZE
CSize
Header: atltypes.h
Constructs a CSize
object.
CSize() throw();
CSize( int initCX, int initCY) throw();
CSize( SIZE initSize) throw();
CSize( POINT initPt) throw();
CSize( DWORD dwSize) throw();
initCX
Sets the cx
member for the CSize
.
initCY
Sets the cy
member for the CSize
.
initSize
SIZE structure or CSize
object used to initialize CSize
.
initPt
POINT structure or CPoint
object used to initialize CSize
.
dwSize
DWORD used to initialize CSize
. The low-order word is the cx
member and the high-order word is the cy
member.
If no arguments are given, cx
and cy
are initialized to zero.
[!code-cppNVC_ATLMFC_Utilities#97]
Checks for equality between two sizes.
BOOL operator==(SIZE size) const throw();
Returns nonzero if the sizes are equal, otherwize 0.
[!code-cppNVC_ATLMFC_Utilities#98]
Checks for inequality between two sizes.
BOOL operator!=(SIZE size) const throw();
Returns nonzero if the sizes are not equal, otherwise 0.
[!code-cppNVC_ATLMFC_Utilities#99]
Adds a size to this CSize
.
void operator+=(SIZE size) throw();
[!code-cppNVC_ATLMFC_Utilities#100]
Subtracts a size from this CSize
.
void operator-=(SIZE size) throw();
[!code-cppNVC_ATLMFC_Utilities#101]
These operators add this CSize
value to the value of parameter.
CSize operator+(SIZE size) const throw();
CPoint operator+(POINT point) const throw();
CRect operator+(const RECT* lpRect) const throw();
See the following descriptions of the individual operators:
-
operator +( size )
This operation adds two
CSize
values. -
operator +( point )
This operation offsets (moves) a POINT (or CPoint) value by this
CSize
value. Thecx
andcy
members of thisCSize
value are added to thex
andy
data members of thePOINT
value. It is analogous to the version of CPoint::operator + that takes a SIZE parameter. -
operator +( lpRect )
This operation offsets (moves) a RECT (or CRect) value by this
CSize
value. Thecx
andcy
members of thisCSize
value are added to theleft
,top
,right
, andbottom
data members of theRECT
value. It is analogous to the version of CRect::operator + that takes a SIZE parameter.
[!code-cppNVC_ATLMFC_Utilities#102]
The first three of these operators subtract this CSize
value to the value of parameter.
CSize operator-(SIZE size) const throw();
CPoint operator-(POINT point) const throw();
CRect operator-(const RECT* lpRect) const throw();
CSize operator-() const throw();
The fourth operator, the unary minus, changes the sign of the CSize
value. See the following descriptions of the individual operators:
-
operator -( size )
This operation subtracts two
CSize
values. -
operator -( point )
This operation offsets (moves) a POINT or CPoint value by the additive inverse of this
CSize
value. Thecx
andcy
of thisCSize
value are subtracted from thex
andy
data members of thePOINT
value. It is analogous to the version of CPoint::operator - that takes a SIZE parameter. -
operator -( lpRect )
This operation offsets (moves) a RECT or CRect value by the additive inverse of this
CSize
value. Thecx
andcy
members of thisCSize
value are subtracted from theleft
,top
,right
, andbottom
data members of theRECT
value. It is analogous to the version of CRect::operator - that takes a SIZE parameter. -
operator -()
This operation returns the additive inverse of this
CSize
value.
[!code-cppNVC_ATLMFC_Utilities#103]