void CWork::DoDataExchange(CDataExchange* pDX){CDialog::DoDataExchange(pDX);SetWindowPos(NULL,0,0,900,460,SWP_NOMOVE | SWP_NOZORDER);
上面是初始化窗体的大小。
增加事件响应来 实现窗体的折叠,展开(改变大小)
//折叠窗体void CWork::Onkuozhan() { // TODO: Add your control notification handler code here// CRect rect;// GetClientRect(&rect);//得到客户端矩形// MoveWindow(rect.Width()/3,rect.Height()/3,rect.Width(),rect.Height()/1.5);//移动窗口 SetWindowPos(NULL,0,0,900,460,SWP_NOMOVE | SWP_NOZORDER); //CMenu *pMenu=GetMenu();//获取菜单栏主菜单 //CMenu *pTestMenu=pMenu->GetSubMenu(1);//获取子菜单}//展开窗体void CWork::Onhuanyuan() { // TODO: Add your control notification handler code here SetWindowPos(NULL,0,0,900,730,SWP_NOMOVE | SWP_NOZORDER);}