How can I incorporate in a ribbon category, 2 panels with different image resources?

360 views Asked by At

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?

1

There are 1 answers

0
sergiol On

I have my icons separated each one, and in my CMFCRibbonBar derived class, I use something like:

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