如何重命名MFC功能区面板? [英] How do I rename the MFC ribbon panel?

查看:202
本文介绍了如何重命名MFC功能区面板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个多语言应用程序,该应用程序支持从一种语言到另一种语言的动态切换.由于在类CMFCRibbonPanel中有一个GetName函数,我认为也应该有一个SetName函数.但是不幸的是我找不到想要的功能.如何动态重命名功能区面板?非常感谢.

I am programming a multi-language application which supports dynamical switch from one language to another. Since there is a GetName function in class CMFCRibbonPanel, I think there should also be a SetName function. But unfortunately I can't find the desired function. How do I rename a ribbon panel dynamically? Thank you very much.

推荐答案

面板名称受保护.

您可以从CMFCRibbon派生自己的类并添加"SetName"方法.

you can derive your own class from CMFCRibbon and add a "SetName" method.

class MyRibbonPanel : public CMFCRibbonPanel
{
public:
    MyRibbonPanel(LPCTSTR lpszName = NULL, HICON hIcon = NULL ) : CMFCRibbonPanel(lpszName, hIcon) {};
    void SetName(CString& name ) { m_strName = name; };
};

例如(在VS2010中创建虚拟SDI应用程序之后)

for example ( after creating a dummy SDI application in VS2010 )

CMFCRibbonCategory* pCategory = m_wndRibbonBar.AddCategory(_T("&Legume"),
    IDR_PROPERTIES,
    IDB_PROPERTIES_HC );


MyRibbonPanel* pMyPanel = (MyRibbonPanel*)pCategory->AddPanel(_T("Patate"), m_PanelImages.ExtractIcon(1));
pMyPanel->SetKeys(_T("zc"));
pMyPanel->SetCenterColumnVert();
pMyPanel->SetJustifyColumns();

CString s(_T("sdcasdc"));
pMyPanel->SetName(s);

这篇关于如何重命名MFC功能区面板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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