我想让SDI里一个CFormView设为全屏,我在得到屏幕大小后用MoveWindow后只能占满用户区,程序的工具栏等都不行。请问如何做。谢谢!

解决方案 »

  1.   

    调用pWnd->SetWindowPos(NULL,0,0,screen_width,screen_height,SWP_SHOWWINDOW)或者SetWindowPlacement可以让窗口启动的时候全屏我也是道听途说,不知道是不是好用。你试试看吧。我也是初学。
      

  2.   

    void CMainFrame::OnFullScreen()
      {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);
      // 将除控制条外的客户区全屏显示到从(0,0)到(nFullWidth, nFullHeight)区
    域, 将(0,0)和(nFullWidth, nFullHeight)两个点外扩充原窗口和除控制条之外的 客
    户区位置间的差值, 就得到全屏显示的窗口位置
      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;
      m_bFullScreen=TRUE; // 设置全屏显示标志为 TRUE
      // 进入全屏显示状态
      WINDOWPLACEMENT wndpl;
      wndpl.length=sizeof(WINDOWPLACEMENT);
      wndpl.flags=0;
      wndpl.showCmd=SW_SHOWNORMAL;
      wndpl.rcNormalPosition=m_FullScreenRect;
      SetWindowPlacement(&wndpl);}