Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 2: Introduction to MFC


2.2.6 Windows Size..........................................................................................


While a point is used to locate an object on the screen, each window has a size. The size
provides two measurements related to an object. The size of an object can be represented
as follows:

Figure 31: Illustration of Window Location..............................................................................


The width of an object, represented as CX, is the distance from its left to its right borders
and is provided in pixels.

The height of an object, represented as CY is the distance from its top to its bottom
borders and is given in pixels.

To represent these measures, the Win32 library uses the SIZE structure defined as
follows:

typedef struct tagSIZE {
int cx;
int cy;
} SIZE;

Besides the Win32's SIZE structure, the MFC provides the CSize class. This class has
the same functionality as SIZE but adds features of a C++ class. For example, it provides
five constructors that allows you to create a size variable in any way of your choice. The
constructors are:
Free download pdf