Re: Anyone Figured Out How to Set Menu Image in Feature Pack?
I finally found a way to add menu items with images.
I was calling CMFCRibbonButton::SetMenu() to assign a menu to my button. I
found I could then use CMFCRibbonButton::AddSubItem(new
CMFCRibbonButton(...)) to add additional items to the menu. This worked fine
but, to my frustration, the images still did not appear. I even found that
if I included a large image, then the large image would show. But not the
small one!
Playing around, however, I found that if I leave out the call to SetMenu()
and simply add all menu subitems to the button, then my small images do
show.
So I ended up with the following:
CMFCRibbonButton *pButton;
pButton = new CMFCRibbonButton(ID_OPTIONS, _T("Tools"), 1, 1);
pButton->AddSubItem(new CMFCRibbonButton(ID_TRANSACTIONS_VIEWLOGFILE,
_T("View Log File"), 2));
pButton->AddSubItem(new CMFCRibbonButton(ID_TRANSACTIONS_DELETELOGFILE,
_T("Delete Log File"), 3));
pButton->AddSubItem(new CMFCRibbonButton(ID_TRANSACTIONS_VIEWRAWTRANS,
_T("View RAWTRANS.DAT...")));
pButton->AddSubItem(new CMFCRibbonSeparator(TRUE));
pButton->AddSubItem(new CMFCRibbonButton(ID_OPTIONS, _T("Options..."), 4));
pPanelTransactions->Add(pButton);
This seems to work great, and allows me to avoid the popup menu resource
altogether.
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com