Programming with Microsoft Visual C++.NET 6ed [Electronic resources]

George Shepherd, David Kruglinski

نسخه متنی -صفحه : 319/ 132
نمايش فراداده

The Default Window Rectangle

You're used to defining rectangles using device or logical coordinates. A CRect object constructed with the following statement has a special meaning:

CRect rect(CW_USEDEFAULT, CW_USEDEFAULT, 0, 0);

When Windows creates a new window with this special rectangle, it positions the window in a cascade pattern with the top left corner below and to the right of the window most recently created. The right and bottom edges of the window are always within the display's boundaries.

The CFrameWnd class's static rectDefault data member is constructed using CW_USEDEFAULT in this way, so it contains the special rectangle. The CPersistentFrame class declares its own rectDefault default window rectangle with a fixed size and position as a static data member, thus hiding the base class member.