下面这段关于"对话框中控件自动变化"代码怎么改进?
OnSize(UINT nType, int cx, int cy){ CDialog::OnSize(nType, cx, cy); // TODO: Add your message handler code here double dX = ( double)cx /pointOld. x; double dY = (double) cy/pointOld .y; if (nType == SIZE_MINIMIZED) return; int left ,top, newWidth,newHeight ; HWND hwndChild =::GetWindow( m_hWnd,GW_CHILD ); //列出所有控件 CWnd *pWnd ; while(hwndChild ) { pWnd = FromHandle (hwndChild); CRect rect ; pWnd->GetWindowRect (&rect); ScreenToClient(rect ); left =(int )(rect. left*dX ); top = (int )(rect. top*dY ); newWidth = (int )(rect. Width() * dX ); newHeight = (int )(rect. Height() * dY ); pWnd->MoveWindow (left, top,newWidth ,newHeight); hwndChild=::GetWindow (hwndChild, GW_HWNDNEXT); } pointOld.x = cx; pointOld.y = cy; Invalidate();}