//調用這個函數 void CMainFrame::OnFullScreen() { // TODO: Add your command handler code here 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); CRect m_FullScreenRect; m_FullScreenRect.left=WindowRect.left-ClientRect.left; m_FullScreenRect.top=WindowRect.top-ClientRect.top; m_FullScreenRect.right=WindowRect.right-ClientRect.right+nFullWidth; m_FullScreenRect.bottom=WindowRect.bottom-ClientRect.bottom+nFullHeight; //進入全屏顯示狀態 WINDOWPLACEMENT wndpl; wndpl.rcNormalPosition=m_FullScreenRect; SetWindowPlacement(&wndpl); }