MFC Adjusts dialog box size as needed

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.