1

I am working with CMFCRibbonCategory and my category should have 2 panels. The problem is that I would like to specify a set of button images for each panel. I don't want to join the two bmp files into one in order to use them.

This is how I normally set the image for a button:

    _btnTest = new CMFCRibbonButton(ID_BTN_TEST,  CResourceHelper::GetStringFromRes(IDS_BTN_TEST), 1, 1);
    _btnTest->SetAlwaysLargeImage(TRUE);
    _ribbonPanel->Add(_btnTest); 

The value 1 specifies which image I want to use. I previously set the image resource for the entire category where I am going to add my panel.

    _ribbonCategory = wndRibbonBar->AddCategory(
            CResourceHelper::GetStringFromRes(IDS_CATEGORY_NAME), 
            IDB_TOOLBAR_IMG, 
            IDB_TOOLBAR_IMG,
            CSize(16, 16), 
            CSize(32, 32), 
            -1, 
            NULL);

Therefore, how can I set the 2 image resources?

4

1 回答 1

0

我将每个图标分开,在我的 CMFCRibbonBar 派生类中,我使用了类似的东西:

CMFCToolBarImages* pImageList;

pImageList= &GetCategory(0)->GetLargeImages();
pImageList->AddIcon(theApp.LoadIcon(IDI_SOME_ICON), true);

//.. and so on for every button and category assuming tha you have correctly set the image indexes
于 2014-04-08T14:32:15.360 回答