It is usually necessary to dynamically adjust the size and proportions of the dialog box and the inside controls before displaying them, depending on the resolution of the image, when writing pictures or images to display related programs. Here's how it's easy to adjust the size and position of the dialog box , just the following code
int screenwidth = GetSystemMetrics (Sm_cxfullscreen);//Get screen resolution width, excluding fields such as taskbar int screenheight = GetSystemMetrics (sm_ Cyfullscreen);//Get screen resolution height, excluding areas such as taskbar CRect rect (SCREENWIDTH/2-SCREENWIDTH/4, SCREENHEIGHT/2-SCREENHEIGHT/4, Scre ENWIDTH/2 + SCREENWIDTH/4, SCREENHEIGHT/2 + SCREENHEIGHT/4); Gets the size of the control before it changes CWnd *pwnd = AfxGetMainWnd ();p Wnd->movewindow (rect);
the code above simply moves the dialog box to the middle of the screen, and the length and width are one-second of the screen. Next, we need to adjust the size of the dialog box to set the position of the control, this step is actually a more complex point, fortunately, this article has been introduced before, it is no longer here to repeat.
MFC Adjusts dialog box size as needed