/// // 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 ;}