重载WM_SIZE消息响应函数,然后在响应消息函数里调用子窗口的MoveWindow()函数,在MoveWindow()指定位置和大小 void CMainFrame::OnSize(UINT nType, int cx, int cy) { CFrameWnd::OnSize(nType, cx, cy); // TODO: Add your message handler code here if (NULL != m_ConsoleCtr.GetSafeHwnd()) { RECT rect; GetClientRect(&rect); m_ConsoleCtr.MoveWindow(&rect); } }