龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > VC开发 >

在VC++6.0开发中实现全屏显示(2)

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
// 将除控制条外的客户区全屏显示到从(0,0)到(nFullWidth, nFullHeight)区域, 将(0,0)和(nFullWidth, nFullHeight)两个点外扩充原窗口和除控制条之外的 客户区位置间

  // 将除控制条外的客户区全屏显示到从(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);}

  4)重载CMainFrame类的OnGetMinMaxInfo函数,在全屏显示时提供全屏显示的位置信息。

  void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)

  {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();

  // 最大的Track尺寸也要改变

  lpMMI->ptMaxTrackSize.x=m_FullScreenRect.Width();

  lpMMI->ptMaxTrackSize.y=m_FullScreenRect.Height();

  }CFrameWnd::OnGetMinMaxInfo(lpMMI)

精彩图集

赞助商链接