sub...@gmail.com
unread,Oct 15, 2012, 11:21:40 AM10/15/12You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi,
It seems when you create a new CMFCRibbonButton with a 32*32 icon image and add subitems to it, you get this line underneath the main image icon then the downward arrow for the sub items. Is there anyway to get rid of this line? I just want a normal menu button with a drop down list like in the RibbonGadgets sample.
The only way around this seems to be loading the button from a menu resource, and passing through false when you call the SetMenu function. We need to add the sub items dynamically otherwise using static resources would be fine.
//split button
std::auto_ptr<CMFCRibbonButton> apBtn3(new CMFCRibbonButton(ID_RIBBON_BTN_3, _T("Split Button"), 2, 2));
apBtn3->SetMenu(IDR_RIBBON_MENU_1);
apBtn3->SetAlwaysLargeImage();
apBtn3->RemoveSubItem(0);
apBtn3->AddSubItem(new CMFCRibbonButton(ID_RIBBON_MBTN_1, _T("Item 1"), 2), 0);
pPanel1->Add(apBtn3.release());
//no split button
std::auto_ptr<CMFCRibbonButton> apBtn3(new CMFCRibbonButton(ID_RIBBON_BTN_3, _T("Split Button"), 2, 2));
apBtn3->SetMenu(IDR_RIBBON_MENU_1, false);
apBtn3->SetAlwaysLargeImage();
apBtn3->RemoveSubItem(0);
apBtn3->AddSubItem(new CMFCRibbonButton(ID_RIBBON_MBTN_1, _T("Item 1"), 2), 0);
pPanel1->Add(apBtn3.release());
Thanks for any suggestions.