Visual C++ - 无法为 MFC 办公样式应用程序的功能区中的按钮设置图标



我能够为 MFC Office 样式应用程序的功能区中的按钮设置的唯一图标是通过按钮属性中的图像索引组合框提供的图标,所有将自定义图像添加为图标的尝试都失败了。

有人可以引导我完成为 MFC 功能区按钮设置图标的过程吗?

而不是在

创建这样的按钮时使用索引

CMFCRibbonButton *btnMyButton = 
    new CMFCRibbonButton (ID_APP_ABOUT, _T("About"), 13, 13);

您也可以这样做:

CMFCToolBarImages m_myOtherPanelImages;
...
CMFCRibbonButton *btnMyButton = new CMFCRibbonButton (ID_APP_ABOUT, 
    _T("About"), m_myOtherPanelImages.ExtractIcon(0));

在我的CMFCRibbonBar派生的clas中,我使用如下的东西:

CMFCToolBarImages* pImageList;
pImageList= &GetCategory(0)->GetLargeImages();
pImageList->AddIcon(theApp.LoadIcon(IDI_SOME_ICON), true);
// ... and so on for every categorry and button, assuming that you have set the LARGE image indexes correctly for each button.

它有效。

最新更新