Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MFC RIbbon Split Button

300 views
Skip to first unread message

sub...@gmail.com

unread,
Oct 15, 2012, 11:21:40 AM10/15/12
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.
0 new messages