How does mfc enable full screen dialog box

Source: Internet
Author: User

Method 1:

Add the following to Dialog: OnInitDialog:

ModifyStyle (WS_CAPTION,); // if you only want a normal full screen and do not want to remove the title bar, you do not need to use the first statement.
SendMessage (WM_SYSCOMMAND, SC _MAXIMIZE, 0 );

 

However, this method is not convenient to adjust the widget location. You can consider method 2.

 

Method 2:
First get the resolution,

Int cx, cy;
Cx = GetSystemMetrics (SM_CXSCREEN );
Cy = GetSystemMetrics (SM_CYSCREEN );

Use MoveWindow

CRect rcTemp;
RcTemp. BottomRight () = CPoint (cx, cy );
RcTemp. TopLeft () = CPoint (0, 0 );
MoveWindow (& rcTemp );

Method 2 because the window and screen parameters are obtained, it is much easier to adjust the positions of some controls on the Dialog.

 

++ ++ ++

However, you can only adjust the widget's size position in OnSize. You need to adjust the size and position of all controls to be adjusted one by one.

For the method, see:

Three steps to solve the control size after the MFC window changes

1. Define POINT Old in the header file; // store the width and height of the dialog box.
2. Add the WM_SIZE message:
3. Add the reseze Function


Http://blog.csdn.net/Small_hunter/article/details/5640101
Detailed code in

 

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.