如何在Outlook中为自定义按钮添加图像图标

本文关键字:按钮 添加 图像 图标 自定义 Outlook | 更新日期: 2023-09-27 18:32:22

我在Outlook中有一个自定义按钮,我必须为同一按钮添加图像图标。

功能区 XML 是:

<button id="GoToAppConfiguration" 
    label="Application Configuration" 
    getImage="GetCustomImage" 
    onAction="GoToAppConfigurationClicked" 
    size="normal" />

我想编写功能区回调方法,但如何编写相同的方法以及如何使用存储在 Addin 项目下的资源文件夹中的图像。

如何在Outlook中为自定义按钮添加图像图标

你只需要从GetCustomImage返回一个Bitmap。下面是一个 c# 示例,假设您已将 BMP 添加到项目资源。

public Bitmap GetCustomImage(Office.IRibbonControl control)
{
    return Properties.Resources.btnAppConfiguration_Image; // resource Bitmap
}