正如标题所说,如果我的MFC功能区应用程序中有一个弹出菜单,它不会在每个菜单选项旁边显示菜单图标。相同的代码,相同的资源在基于工具栏的应用程序中显示图标。我用来显示我的上下文/弹出菜单的代码如下:
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);
有什么方法吗?
修改:按要求使用的资源提取;
IDR_ACTION_ADDPTS MENU
BEGIN
POPUP "_POPUP_"
BEGIN
MENUITEM "Arc 2Pts+Radius", ID_CIRCARC_ARC_2PT_RAD
MENUITEM "Arc 2Pts+Tangent", ID_CIRCARC_ARC_2PT_TAN
MENUITEM "Arc 3Pts", ID_CIRCARC_ARC_3PT
END
END
IDR_ARCS TOOLBAR 16, 15
BEGIN
BUTTON ID_CIRCARC_ARC_2PT_RAD
BUTTON ID_CIRCARC_ARC_2PT_TAN
BUTTON ID_CIRCARC_ARC_3PT
END
STRINGTABLE
BEGIN
ID_CIRCARC_ARC_2PT_RAD "Create an arc with two points and a radius\nArc 2Pts+Radius"
ID_CIRCARC_ARC_2PT_TAN "Create an arc with two points and an incoming tangent\nArc 2Pts+Tangent"
ID_CIRCARC_ARC_3PT "Create an arc with three points\nArc 3Pts"
END