就是有点像Dephi那样的界面~~~该怎么实现呢??如果有实例是最好的,谢~

解决方案 »

  1.   

    步骤如下:
    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()就可以实现全屏和恢复功能。
      

  2.   

    7.在菜单里加入处理项,分别调用FullScreen()和RestoreScreen()就可以实现全屏和恢复功能。
    该如何调用呢?
      

  3.   

    建立一个单文档应用程序,在CMainFrame::OnCreate加入如下语句,
    SetMenu(NULL);
    另外注释掉工具栏和状态栏创建的语句;重载WM_WINDOWPOSCHANGING消息,加入下面代码
    void CMainFrame::OnWindowPosChanging(WINDOWPOS* lpwndpos)
    {
    CFrameWnd::OnWindowPosChanging(lpwndpos); ::SetWindowLong(m_hWnd, GWL_STYLE, 
    ::GetWindowLong(m_hWnd, GWL_STYLE) & 
    (~WS_CAPTION )); 
    }
      

  4.   

    ssfly(VC新丁)你学VC多久了?不会用菜单?
      

  5.   

    zerphy(爱江山更爱美人),刚学:)