+ -
当前位置:首页 → 问答吧 → 如何实现浮动工具栏的显示隐藏问题

如何实现浮动工具栏的显示隐藏问题

时间:2011-12-05

来源:互联网

我新建了一个工具栏,然后把它拖动到客户区中间,想实现单击菜单项的一个子菜单后,工具栏隐藏,再单击,工具栏在原位置显示,因为我用的是VS2010,所以使用的类是CMFCToolBar,并不是继承CControlBar ,所以用不了ShowControlBar()函数,我想问一下,CPane类中有没有类似的函数,或者有没有其他方法可以使其显示在原来的位置上

作者: xishuinabian   发布时间: 2011-12-05



C/C++ code


BOOL ShowWindow( int nCmdShow );

SW_HIDE   Hides this window and passes activation to another window.

SW_SHOW   Activates the window and displays it in its current size and position.




作者: bazzi2011   发布时间: 2011-12-05

C/C++ code

if(m_newToolBar.IsWindowVisible())
        m_newToolBar.ShowWindow(SW_HIDE);
    else
        m_newToolBar.ShowWindow(SW_SHOW);
    
    m_newToolBar.RecalcLayout();
    DockPane(&m_newToolBar);



这样写之后可以隐藏了,但如果我把自己定义的工具栏拖到窗口中间就不行了

作者: xishuinabian   发布时间: 2011-12-05