如何向 MFC 功能区按钮添加图标

发布于 2024-12-18 06:31:13 字数 187 浏览 4 评论 0原文

我使用 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月竹挽风 2024-12-25 06:31:13

您可以为每个功能区类别仅使用一个文件。

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

  2. 像资源一样添加文件

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

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

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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文