How to add icons to MFC ribbon buttons

喜夏-厌秋 提交于 2020-01-01 19:30:54

问题


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.

  1. Create your png file (32x256 for instance)

  2. Add the file like a resource

  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!