如何将图标添加到MFC功能区按钮 [英] How to add icons to MFC ribbon buttons

查看:424
本文介绍了如何将图标添加到MFC功能区按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用带有功能区的Visual C ++ 2010创建了一个MFC应用程序。我已经为此功能区添加了按钮,但我不知道如何将图像添加到这些按钮。我尝试从项目中编辑writelarge.bmp文件,并在这些按钮上设置图像索引,但现在功能区图标看起来非常难看。除了从项目中编辑writelarge.bmp文件之外,还有一种简单的方法可以向功能区图像添加图标吗?

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?

推荐答案

你有每个RibbonCategory只能使用一个文件的可能性。

You have the possibility to use only one file for each RibbonCategory.


  1. 创建你的png文件(例如32x256)

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

像资源一样添加文件

始终在资源视图中,选择RibbonCategory并设置大图像属性为您的PNG资源标识符(如IDB_MYMENU_PNG)。

Always in the Resource View, select your RibbonCategory and set the "Large Images" property to your PNG resource identifier (like IDB_MYMENU_PNG).

我也有很多使用bmp格式的问题(图像不可见,透明度被删除,...)这就是我推荐png格式的原因。

I also have many issues using bmp format (image not visible, transparency deleted, ...) that's why I recommand the png format.

为了在同一类别中使用原始图像和自定义图像,我创建了一个png文件是两者的合并。

In order to use original and custom images in the same category, I created a png file which is a merge of both.

这篇关于如何将图标添加到MFC功能区按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆