Visual C++ and MFC Fundamentals Chapter 12: Dialog-Based Windows
- In the Add Resource dialog box, click Dialog and click New
- Click OK on the dialog box and press Delete twice to dismiss the OK and the Cancel
buttons
If you are using MSVC 6 and the Properties window is not displaying, right-click the
dialog box and click Properties - In the Properties window, select IDD_DIALOG1. Type IDD_EXERCISE_DLG
and press Enter
12 .1.3..Dialog Box Location...........................................................................
Like the other controls and as we have reviewed their primary characteristics so far, a
dialog box must be “physically” located on an application. Because a dialog box is
usually created as a parent to other controls, its location depends on its relationship to its
parent window or to the desktop. The location of a dialog box is defined by x for the
distance from the left border of the monitor to the left border of the dialog box and by y
for the distance from the top border of the monitor to the top border of the dialog box:
IDD_SCHOOL_SURVEY DIALOGEX x, y,
At design time, the x value is set using the X Pos field of the Properties window. The y
value is set using the Y Pos value in the Properties window.
If you specify these two dimensions as 0, the left and top borders of the dialog box would
be set so the object appears in the center-middle of the screen:
IDD_SCHOOL_SURVEY DIALOGEX 0 , 0 ,
If you set the value of x or X Pos property to a number less than or equal to 0, the left
border of the dialog box would be aligned with the left border of the monitor. If you set
the value of x or of the X Pos property higher than 0, the value would be used as the
distance, in Dialog Box Unit (DLU), from the left border of the screen to the left border
of the dialog box. This scenario also applies for the y value or the Y Pos property.