小弟的程序中有一个悬浮工具栏,关闭后不知如何重新显示,请高手赐教!

解决方案 »

  1.   

    CMainFrame::ShowControlBar to hide/show any control bar
      

  2.   

    CWnd *pBar;
        if(m_wndMyDialogBar.IsFloating())
        {
             if(pBar = m_wndMyDialogBar.GetParentFrame())
                  pBar->ShowWindow((pBar->GetStyle() & WS_VISIBLE) == 0);
        }
        else
        {
             if(pBar = GetDescendantWindow(ID_MYTOOL_DIALOGBAR))
             {
                  pBar->ShowWindow((pBar->GetStyle() & WS_VISIBLE) == 0);
                  RecalcLayout();
             }
        }
    //m_dMyDiwnalogBar:你的工具栏得对象  ID_MYTOOL_DIALOGBAR//工具栏资源号
    //可以完成隐藏和显示!
      

  3.   

    重新显示
      ShowControlBar(&m_wndToolBar,TRUE,0);
      RecalcLayout();
    或者
      m_wndToolBar.ShowWindow(TRUE);
      DockControlBar(&m_wndToolBar, AFX_IDW_DOCKBAR_LEFT);
      FloatControlBar(&m_wndToolBar,CPoint(20,20));
      RecalcLayout(); 如果想要将悬浮工具栏停靠,使用下述方法
      BOOL bVisible = (m_wndControlBar.GetStyle() & WS_VISIBLE) ;
      if (bVisible == FALSE)
      {
        m_wndControlBar.ShowWindow(TRUE);
        DockControlBar(&m_m_wndControlBar, AFX_IDW_DOCKBAR_LEFT);
        RecalcLayout();
      }