菜单图标不适用于MFC功能区应用程序 [英] Menu icons not working for MFC ribbon app

查看:71
本文介绍了菜单图标不适用于MFC功能区应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所说,如果我的MFC功能区应用程序中有一个弹出菜单,它不会在每个菜单选项旁边显示菜单图标。  相同的代码,相同的资源会在基于工具栏的应用程序中显示图标。  我用来显示我的上下文
/弹出菜单的代码如下;


CMenu菜单;

VERIFY(menu.LoadMenu(m_MenuID));

CMenu * pPopup = menu.GetSubMenu(0);

ASSERT(pPopup! = NULL);

CWnd * pWndPopupOwner = CWnd :: GetFocus();

while(pWndPopupOwner-> GetStyle()& WS_CHILD)

pWndPopupOwner = pWndPopupOwner-> GetParent();

pPopup-> TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,m_MenuPoint.x,m_MenuPoint。 y,

pWndPopupOwner);

for(int i = 0; i< pPopup-> GetMenuItemCount(); i ++)

pPopup-> EnableMenuItem(0,MF_BYPOSITION | MF_ENABLED);



(如前所述,将VC2015中的代码剪切并粘贴到此网络论坛并将其标记为代码块会导致所有代码最终排在一行。 编程论坛相当弱!)


解决方案

我自己没试过,但看起来很有希望 -
http:// blog。 rectorsquid.com/menus-with-icons-in-cmfcribbonbar/


As the title says, if I have a popup menu in my MFC ribbon application, it does not display menu icons beside each menu option.  The same code, same resources does display icons in tool bar based application.  The code I'm using to display my context / popup menu is as follows;

CMenu menu;
VERIFY(menu.LoadMenu(m_MenuID));
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
CWnd* pWndPopupOwner = CWnd::GetFocus();
while (pWndPopupOwner->GetStyle() & WS_CHILD)
pWndPopupOwner = pWndPopupOwner->GetParent();
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, m_MenuPoint.x, m_MenuPoint.y,
pWndPopupOwner);
for (int i=0; i<pPopup->GetMenuItemCount(); i++)
pPopup->EnableMenuItem(0,MF_BYPOSITION | MF_ENABLED);

(As previously reported cutting and pasting a code from VC2015 to this web forum and marking it as a code block results in all the code ending up on one line.  Pretty weak for a programming forum!)

解决方案

I haven't tried this myself but it looks promising -- http://blog.rectorsquid.com/menus-with-icons-in-cmfcribbonbar/


这篇关于菜单图标不适用于MFC功能区应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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