mfc删除默认工具栏 [英] mfc remove default toolbar

查看:68
本文介绍了mfc删除默认工具栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在mfc中为学校项目制作了简单的桌面游戏,设法使我的应用全屏显示并删除了菜单栏,但是我找不到如何从应用中删除默认内置工具栏的信息,状态栏.我尝试了所有想到的事情...从您的CWnd对象调用某种get函数来检索工具栏和状态栏吗?

I've making simple desktop game in mfc for school project, I've managed to make my app be full screen and to remove menu bar but I can't find out how to remove default built in toolbar from my app or status bar. I tried everything that came across my mind...is there some kind of get function to call from your CWnd object to retrieve toolbar and status bar?

推荐答案

ToolBar StatusBar 的创建在 CMainFrame 类内部.如果您不需要它们,可以轻松地将它们删除,如下所示:

The creation of ToolBar and StatusBar is inside the CMainFrame class. You can easily remove them if you do not need them as follows:

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
    return -1;

    // *** creation of ToolBar starts, just remark/delete the whole block if you dont't want it
    if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
        | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
        !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
    {
        TRACE0("Failed to create toolbar\n");
        return -1;      // fail to create
    }
    // *** creation of ToolBar  ends -------------------------------------------------------

    // *** creation of StatusBar starts, just remark/delete the whole block if you dont't want it
    if (!m_wndStatusBar.Create(this) ||
        !m_wndStatusBar.SetIndicators(indicators,
          sizeof(indicators)/sizeof(UINT)))
    {
        TRACE0("Failed to create status bar\n");
        return -1;      // fail to create
    }
    // *** creation of StatusBar ends -------------------------------------------------------

    // *** you have to remark/delete these lines too, if you removed the ToolBar above
    m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
    EnableDocking(CBRS_ALIGN_ANY);
    DockControlBar(&m_wndToolBar);
    // *** ToolBar extra ends -------------------------------------------------------

    return 0;

}

这篇关于mfc删除默认工具栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆