.h里定义:
CPoint oldPoint;
OnInitDialog里添加:
CRect rect;
GetClientRect(&rect); / / get the client area size
oldPoint. X= rect.right - rect.left ;
oldPoint.y= rect.bottom - rect.top ;
响应WM_ SIZE消息:
if(nType==SIZE_RESTORED || nType==SIZE_MAXIMIZED)
关键代码:
float fsp[2];
POINT newPoint;//获取当前对话框大小
CRect newRect;//获取当前对话框的坐标
GetClientRect(&newRect);
newPoint.x = newRect.right - newRect.left;
newPoint.y = newRect.bottom - newRect.top;
fsp[0] = (float)newPoint.x / oldPiont.x;
fsp[1] = (float)newPoint.y / oldPiont.y;
int woc;
CRect rect;
CPoint oldTLPoint, newTLPoint;//左上角
CPoint oldBRPoint, newBRPoint;//右下角
//列出所有的子空间
HWND hwndChild = ::GetWindow(m_hWnd, GW_CHILD);
while (hwndChild) {