15,979
社区成员
发帖
与我相关
我的任务
分享
void CMainFrame::OnFullscreen()
{
// TODO: Add your command handler code here
GetWindowPlacement(&m_OldWndPlacement);
CRect WindowRect;
GetWindowRect(&WindowRect);
CRect ClientRect;
RepositionBars(0,0xffff,AFX_IDW_PANE_FIRST,reposQuery,&ClientRect);
ClientToScreen(&ClientRect);
int nFullWidth=GetSystemMetrics(SM_CXSCREEN);
int nFullHeight=GetSystemMetrics(SM_CYSCREEN);
m_FullScreenRect.left=WindowRect.left-ClientRect.left;
m_FullScreenRect.right=WindowRect.right-ClientRect.right+nFullWidth;
m_FullScreenRect.top=WindowRect.top-ClientRect.top;
m_FullScreenRect.bottom=WindowRect.bottom-ClientRect.bottom+nFullHeight;
m_bFullScreen=TRUE;
WINDOWPLACEMENT wndpl;
wndpl.length=sizeof(WINDOWPLACEMENT);
wndpl.flags=0;
wndpl.showCmd=SW_SHOWNORMAL;
wndpl.rcNormalPosition=m_FullScreenRect;
SetWindowPlacement(&wndpl);
}
void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
// TODO: Add your message handler code here and/or call default
if(m_bFullScreen)
{
lpMMI->ptMaxSize.x=m_FullScreenRect.Width();
lpMMI->ptMaxSize.y=m_FullScreenRect.Height();
lpMMI->ptMaxPosition.x=m_FullScreenRect.Width();
lpMMI->ptMaxPosition.y=m_FullScreenRect.Height();
lpMMI->ptMaxTrackSize.x=m_FullScreenRect.Width();
lpMMI->ptMaxTrackSize.y=m_FullScreenRect.Height();
}
CFrameWnd::OnGetMinMaxInfo(lpMMI);
}
void CMainFrame::EndFullScreen()
{
if(m_bFullScreen)
{
ShowWindow(SW_HIDE);
SetWindowPlacement(&m_OldWndPlacement);
}
}
void CMainFrame::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
if(nChar==VK_ESCAPE)
{
CMainFrame *pFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd;
pFrame->EndFullScreen();
}
CFrameWnd::OnKeyDown(nChar, nRepCnt, nFlags);
}