void CXXXDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
CRect rectDlg;
CPaintDC dc(this);
GetClientRect(rectDlg);
CRect rectBar;
//工具栏
CToolBar *m_pwndToolBar = (CToolBar *)AfxGetApp()->m_pMainWnd->
GetDescendantWindoW(AFX_IDW_TOOLBAR);
m_pwndToolBar->GetClientRect(&rectBar);
//如果不加4,经过若干次最窗口改变大小,则工具栏被完全覆盖
m_pwndToolBar->MoveWindow(0,0,rectDlg.Width(),rectBar.Height()+4);
//状态栏
CStatusBar *m_pwndStatusBar = (CStatusBar *)AfxGetApp()->m_pMainWnd->
GetDescendantWindow(AFX_IDW_STATUS_BAR);
m_pwndStatusBar->GetClientRect(&rectBar);
m_pwndStatusBar->MoveWindow(0,cy-rectBar.Height(),rectDlg.Width(),rectBar.Height());
// 绘制对话框背景色
dc.FillSolidRect(rectDlg,RGB(255,255,255)); //设置为白色
}
更多技术文章请参看施昌权的个人网站: http://www.joyvc.cn