想请教一下,一个基于文档/视图结构的程序的窗口边框可否cut掉,比如显示图像时就只看到图像,标题栏什么的全都隐去? 说说思路 或给出示例代码最好

解决方案 »

  1.   

    虽然是基于框架的程序,但是你显示图片的时候还是可以用Dialog啊,那样要方便很多,而且不知道你既然要这样显示,为什么非要用框架程序呢?
      

  2.   

    通常没有见到过普通窗口大小状态下实现的。
    从CView继承过来的试图类可以做到。做法是将其他部分隐藏,将需要的部分全屏
    void CMainFrame::OnScreenFull() 
    {
    // TODO: Add your command handler code here
    RECT DesktopRect;
        WINDOWPLACEMENT WPNew; //m_FullScreen = m_FullScreen ? TRUE : FALSE;    if(!m_FullScreen)
        {        // need to hide all status bars
            m_wndStatusBar.ShowWindow(SW_HIDE);
        m_wndToolBar.ShowWindow(SW_HIDE);
            //Adjust RECT to new size of window
        ::GetWindowRect(::GetDesktopWindow(), &DesktopRect);
         m_wndSplitter.GetPane(0,0)->ShowWindow(SW_HIDE);
    m_wndSplitter2.GetPane(1,0)->ShowWindow(SW_HIDE);
    m_wndSplitter.GetColumnInfo(0,x,x1);
    m_wndSplitter2.GetRowInfo(0,y,y1);
    CRect tabrect;
    CPeerOperatorTabCtrl *tabctrl;
    tabctrl=(CPeerOperatorTabCtrl *)m_wndSplitter2.GetPane(0,0);
    tabctrl->GetItemRect(0,&tabrect);
        // We'll need these to restore the original state.
        GetWindowPlacement (&m_WPPrev);
    m_wndSplitter.SetColumnInfo( 0,0,0);
    m_wndSplitter2.SetRowInfo( 0,DesktopRect.bottom-DesktopRect.top+tabrect.Height()+44,0);     m_WPPrev.length = sizeof m_WPPrev; DesktopRect.left -= 1+16;
    DesktopRect.top -= tabrect.Height()+44;
    DesktopRect.bottom += 2+16;
    DesktopRect.right += 2+8;     ::AdjustWindowRectEx(&DesktopRect, GetStyle(), TRUE, GetExStyle());     // Remember this for OnGetMinMaxInfo()
        m_FullScreenWindowRect = DesktopRect;
            
            WPNew = m_WPPrev;
            WPNew.showCmd =  SW_SHOWNORMAL;
        WPNew.rcNormalPosition = DesktopRect;
        
    //        m_pWndFullScreenBar=new CToolBar;
    //
    //        if(!m_pWndFullScreenBar->Create(this,CBRS_SIZE_DYNAMIC|CBRS_FLOATING) ||
    //        !m_pWndFullScreenBar->LoadToolBar(IDR_SCREEN_FULL))
    //     {
    //      TRACE0("Failed to create toolbar\n");
    // return; // fail to create
    //         }
    //        
    //        //don't allow the toolbar to dock
    // m_pWndFullScreenBar->ModifyStyle(WS_CAPTION,0);
    //        m_pWndFullScreenBar->EnableDocking(0);
    // m_pWndFullScreenBar->SetWindowPos(0, 0,0, 0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_SHOWWINDOW);
    // m_pWndFullScreenBar->SetWindowText(_T("Hold Ctrl+F to switch between normal and a full screen"));
    // FloatControlBar(m_pWndFullScreenBar, CPoint(0,0));
    // m_pWndFullScreenBar->EnableToolTips(TRUE);
    m_FullScreen=TRUE;
        }
        else
        {
    //        m_pWndFullScreenBar->DestroyWindow();
    // delete m_pWndFullScreenBar;        m_FullScreen=FALSE;        m_wndStatusBar.ShowWindow(SW_SHOWNORMAL);
        m_wndToolBar.ShowWindow(SW_SHOWNORMAL);
         m_wndSplitter.GetPane(0,0)->ShowWindow(SW_SHOWNORMAL);
    m_wndSplitter2.GetPane(1,0)->ShowWindow(SW_SHOWNORMAL);
    m_wndSplitter.SetColumnInfo(0,x,x1);
    m_wndSplitter2.SetRowInfo( 0,y,y1);
            WPNew = m_WPPrev;
        }
        
        SetWindowPlacement(&WPNew);
    }
      

  3.   

    在C***App::InitInstance()
    {
    ...
    DWORD dwStyle = GetWindowLong(m_pMainWnd->GetSafeHwnd(),GWL_STYLE);
    DWORD dwExStyle = GetWindowLong( m_pMainWnd->GetSafeHwnd(),GWL_EXSTYLE );
    dwExStyle &= ~(WS_EX_CLIENTEDGE|WS_EX_WINDOWEDGE);
    dwStyle &= ~(WS_BORDER|WS_SYSMENU|WS_OVERLAPPED|WS_MINIMIZEBOX|WS_MAXIMIZEBOX);
    SetWindowLong(m_pMainWnd->GetSafeHwnd(),GWL_STYLE,dwStyle);
    SetWindowLong(m_pMainWnd->GetSafeHwnd(),GWL_EXSTYLE,dwExStyle);
    m_pMainWnd->MoveWindow(CRect(50,50,400,300),TRUE);m_pMainWnd->ShowWindow(SW_SHOW);
    m_pMainWnd->UpdateWindow();
    }