The MFC form control varies with the form.

Source: Internet
Author: User
/// // Defines the function, variable /////////////// /// void resize (); POINT Old; // store the width and height of the dialog box ///////////////////////////////// /////////////// void CNewFrameDlg:: OnSize (UINT nType, int cx, int cy) {CDialog: OnSize (nType, cx, cy); if (nType = SIZE_RESTORED | nType = SIZE_MAXIMIZED) // The form size changes. Processing Function resize {resize () ;}} void CNewFrameDlg: resize () {float fsp [2]; POINT Newp; // obtain the size of the current dialog box CRect recta; getClientRect (& recta); // obtain the Newp. x = recta. right-recta.left; Newp. y = recta. bottom-recta.top; fsp [0] = (float) Newp. x/Old. x; fsp [1] = (float) Newp. y/Old. y; CRect Rect; int woc; CPoint OldTLPoint, TLPoint; // CPoint OldBRPoint and BRPoint in the upper left corner; // HWND hwndChild =: GetWindow (m_hWnd, GW_CHILD) in the lower right corner ); // list all controls while (hwndChild) {woc =: GetDlgCtrlID (hwndChild); // obtain the ID if (woc = IDC_LIST1 | woc = IDC_STATICFRAME) {GetDlgItem (woc)-> GetWindowRect (Rect); ScreenToClient (Rect); OldTLPoint = Rect. topLeft (); TLPoint. x = long (OldTLPoint. x * fsp [0]); TLPoint. y = long (OldTLPoint. y * fsp [1]); OldBRPoint = Rect. bottomRight (); BRPoint. x = long (OldBRPoint. x * fsp [0]); BRPoint. y = long (OldBRPoint. y * fsp [1]); Rect. setRect (TLPoint, BRPoint); if (woc = IDC_LIST1) {GetDlgItem (woc)-> MoveWindow (CRect (TLPoint. x, TLPoint. y, TLPoint. x + (OldBRPoint. x-OldTLPoint.x), BRPoint. y/* TLPoint. y + (OldBRPoint. y-OldTLPoint.y) */), TRUE);} else {GetDlgItem (woc)-> MoveWindow (Rect, TRUE);} hwndChild =: GetWindow (hwndChild, GW_HWNDNEXT );}} old = Newp ;}

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.