就是有点像Dephi那样的界面~~~该怎么实现呢??如果有实例是最好的,谢~
解决方案 »
- Visual studio 2010 开发的ACCESS数据库访问程序部署到其他计算机时,不能打开数据库,请大侠指点!
- 每天一贴之SVN版本修改
- 打印尺寸问题
- 动态创建不规则的Static?
- 怎么用InstallShield 制作卸载程序?
- CDialogBar里面不能响应DoDataExchange函数
- 请问在局域网内部(通过代理可上网)如何与公网的SERVER相连接?
- VC处理ADO时的怪问题,高分救助----在线等!!!
- 如何将字符串转化成16进制 存储在char型数组中
- Win32 API Tree control and comboBox
- 视图切换时出错,帮忙呀!!!
- 我想实现这些功能谁给些提示:应该查哪方面的资料?
1.建立MDI工程
2.打开MainFrm.h和MainFrm.cpp文件;
3.在MainFrm.h文件中加入:
private:
WINDOWPLACEMENT m_wpOldPlacement;
BOOL m_bFull;
CRect m_rectFull;
4.在MainFrm.cpp的构造函数中加入:
CMainFrame::CMainFrame()
{
this->m_bFull = FALSE;
}
5.利用ClassWizard添加CMainFrame类的函数:
void CMainFrame::FullScreen(void)
{
GetWindowPlacement(&(this->m_wpOldPlacement));
CRect WindowRect;
GetWindowRect(&WindowRect);
CRect ClientRect;
RepositionBars(0, 0x0001, AFX_IDW_PANE_FIRST, reposQuery, &ClientRect);
ClientToScreen(&ClientRect);
int nFullX = GetSystemMetrics(SM_CXSCREEN);
int nFullY = GetSystemMetrics(SM_CYSCREEN); this->m_rectFull.left = WindowRect.left - ClientRect.left;
this->m_rectFull.top = WindowRect.top - ClientRect.top;
this->m_rectFull.right = WindowRect.right - ClientRect.right + nFullX;
this->m_rectFull.bottom = WindowRect.bottom - ClientRect.bottom + nFullY;
this->m_bFull = TRUE; WINDOWPLACEMENT wpNew;
wpNew.length = sizeof(WINDOWPLACEMENT);
wpNew.flags = 0;
wpNew.showCmd = SW_SHOWNORMAL;
wpNew.rcNormalPosition = this->m_rectFull;
SetWindowPlacement(&wpNew);
}void CMainFrame::RestoreScreen(void)
{
if (this->m_bFull)
{
//ShowWindow(SW_HIDE);
this->m_bFull = FALSE;
SetWindowPlacement(&(this->m_wpOldPlacement));
ShowWindow(SW_SHOWMAXIMIZED);
}
}6.利用ClassWizard编辑CMainFrame类的WM_GETMINMAXINFO消息相应函数:
void CMainFrame::OnGetMinMaxInfo(MINMAXINFO* lpMMI)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值 if (this->m_bFull)
{
lpMMI->ptMaxSize.x = m_rectFull.Width();
lpMMI->ptMaxSize.y = m_rectFull.Height();
lpMMI->ptMaxPosition.x = m_rectFull.Width();
lpMMI->ptMaxPosition.y = m_rectFull.Height();
// 最大的Track尺寸也要改变
lpMMI->ptMaxTrackSize.x = m_rectFull.Width();
lpMMI->ptMaxTrackSize.y = m_rectFull.Height();
} CMDIFrameWnd::OnGetMinMaxInfo(lpMMI);
}
7.在菜单里加入处理项,分别调用FullScreen()和RestoreScreen()就可以实现全屏和恢复功能。
该如何调用呢?
SetMenu(NULL);
另外注释掉工具栏和状态栏创建的语句;重载WM_WINDOWPOSCHANGING消息,加入下面代码
void CMainFrame::OnWindowPosChanging(WINDOWPOS* lpwndpos)
{
CFrameWnd::OnWindowPosChanging(lpwndpos); ::SetWindowLong(m_hWnd, GWL_STYLE,
::GetWindowLong(m_hWnd, GWL_STYLE) &
(~WS_CAPTION ));
}