• BCG ribbon简单使用(1)


    1、根据新建向导创建一个项目,然后清空MainFrm某些内容,留下简单的几个方法:

    头文件中剩余:

    // MainFrm.h : interface of the CMainFrame class
    //


    #pragma once

    class CMainFrame : public CBCGPMDIFrameWnd
    {
        DECLARE_DYNAMIC(CMainFrame)
    public:
        CMainFrame();

    // Attributes
    public:

    // Operations
    public:

    // Overrides
    public:
        virtual BOOL PreCreateWindow(CREATESTRUCT& cs);

    // Implementation
    public:
        virtual ~CMainFrame();
    #ifdef _DEBUG
        virtual void AssertValid() const;
        virtual void Dump(CDumpContext& dc) const;
    #endif

    protected:  // control bar embedded members
        CBCGPStatusBar            m_wndStatusBar;
        CBCGPMenuBar            m_wndMenuBar;
        CBCGPToolBar            m_wndToolBar;
        CBCGPRibbonDialogBar    m_wndPane;

    // Generated message map functions
    protected:
        afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
        
        afx_msg void OnClose();
        DECLARE_MESSAGE_MAP()
    };
     

    2、实现文件中剩余:

    // MainFrm.cpp : implementation of the CMainFrame class
    //

    #include "stdafx.h"
    #include "ribbonSample1.h"

    #include "MainFrm.h"

    #ifdef _DEBUG
    #define new DEBUG_NEW
    #endif


    // CMainFrame

    IMPLEMENT_DYNAMIC(CMainFrame, CBCGPMDIFrameWnd)

    BEGIN_MESSAGE_MAP(CMainFrame, CBCGPMDIFrameWnd)
        ON_WM_CREATE()
        ON_WM_CLOSE()
    END_MESSAGE_MAP()

    static UINT indicators[] =
    {
        ID_SEPARATOR,           // status line indicator
        ID_INDICATOR_CAPS,
        ID_INDICATOR_NUM,
        ID_INDICATOR_SCRL,
    };

    // CMainFrame construction/destruction

    CMainFrame::CMainFrame()
    {
        // TODO: add member initialization code here
    }

    CMainFrame::~CMainFrame()
    {
    }

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

        return 0;
    }

    BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
        if( !CBCGPMDIFrameWnd::PreCreateWindow(cs) )
            return FALSE;
        // TODO: Modify the Window class or styles here by modifying
        //  the CREATESTRUCT cs

        return TRUE;
    }


    // CMainFrame diagnostics

    #ifdef _DEBUG
    void CMainFrame::AssertValid() const
    {
        CBCGPMDIFrameWnd::AssertValid();
    }

    void CMainFrame::Dump(CDumpContext& dc) const
    {
        CBCGPMDIFrameWnd::Dump(dc);
    }

    #endif //_DEBUG


    // CMainFrame message handlers

    void CMainFrame::OnClose() 
    {
        SaveMDIState(theApp.GetRegSectionPath());
        CBCGPMDIFrameWnd::OnClose();
    }

    接下来向方法里面添加内容:


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

        //这里清空整个菜单
        CBCGPToolBar::EnableQuickCustomization();
        if (!m_wndMenuBar.Create(this))
        {
            TRACE0("Failed to create menubar\n");
            return -1;      // fail to create
        }

        return ;
    }

    效果如下:

  • 相关阅读:
    【K8S系列】深入解析K8S监控
    Linux下NANDFLASH probe函数分析
    关闭VS Code中的鼠标悬停时的提示框(MDN Reference)
    [C# WPF] 如何给控件添加边框(Border)?
    [Hello World] 二分查找笔记
    计算机网络-Traffic-Filter流量过滤策略
    小谈设计模式(24)—命令模式
    DES 加密算法的改进方案
    Spring Boot 技术架构图(InsCode AI 创作助手辅助)
    `算法题解` `AcWing` 1085. 不要62
  • 原文地址:https://blog.csdn.net/u011269801/article/details/126314751