问题
I created with Visual C++ 2010 a MFC application with ribbon. I have added buttons to this ribbon, but I do not know how to add images to these buttons. I tried editing writelarge.bmp file from the project, and setting the index of image on these buttons, but now the ribbon icons looks very ugly. Is there an easy way to add icons to ribbon images, other than editing writelarge.bmp file from the project?
回答1:
You have the possibility to use only one file for each RibbonCategory.
Create your png file (32x256 for instance)
Add the file like a resource
Always in the Resource View, select your RibbonCategory and set the "Large Images" property to your PNG resource identifier (like IDB_MYMENU_PNG).
I also have many issues using bmp format (image not visible, transparency deleted, ...) that's why I recommand the png format.
In order to use original and custom images in the same category, I created a png file which is a merge of both.
来源:https://stackoverflow.com/questions/8277340/how-to-add-icons-to-mfc-ribbon-buttons