Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Chapter 12: Dialog-Based Windows Visual C++ and MFC Fundamentals


// TODO: Add extra initialization here
CWnd* Panel = new CStatic;

Panel->CreateEx(WS_EX_DLGMODALFRAME, "STATIC", NULL,
WS_CHILD | WS_VISIBLE, );

return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

To raise only the borders of a control without including the body of the control, you can
combine WS_EX_CLIENTEDGE and the WS_EX_DLGMODALFRAME extended
styles. Here is an example:

Practical Learning: Extending a Control’s Borders



  1. To create a fancy static control, delete its Caption field and change its ExStyle value
    to 0x201

  2. Test the application

  3. Return to MSVC


11.5.5..Controls Location and Dimensions..................................................


One of the main roles of a parent window is its ability to host other controls. Such
controls are called its children because the parent carries them when it is moved. The
parent also controls the children’s visibility and their availability. These controls are also
called its clients because they request the parental service from it.

The controls are confined to the area of the body offered by the parent window. After
visually adding it to a host, the control assumes a location and takes some dimensions in
a rectangular body of its parent. The origin of this rectangular area is on the upper-left
Free download pdf