C# Outlook 2007/2010关联菜单项图片

C# Outlook 2007/2010关联菜单项图片,c#,contextmenu,outlook-addin,C#,Contextmenu,Outlook Addin,在outlook中将图像设置为自定义上下文菜单项时出现问题。我有一个强烈的要求,使用自定义图像,我提供的我现在就是这样做的: Application.ItemContextMenuDisplay += ApplicationItemContextMenuDisplay; … private void ApplicationItemContextMenuDisplay(CommandBar commandBar, Selection selection) { var c

在outlook中将图像设置为自定义上下文菜单项时出现问题。我有一个强烈的要求,使用自定义图像,我提供的
我现在就是这样做的:

Application.ItemContextMenuDisplay += ApplicationItemContextMenuDisplay;

 private void ApplicationItemContextMenuDisplay(CommandBar commandBar, Selection selection)
    {
        var contextButton = commandBar.Controls.Add(MsoControlType.msoControlButton, missing, missing, missing, true) as CommandBarButton;
        contextButton.Picture = ImageConverter.ImageToPictureDisp(Resources.ContextMenuIcon);
        contextButton.Visible = true;
        contextButton.Caption = Resources.ArchiveMail;
        contextButton.Click += ArchiveButtonClicked;
    }
我的图像转换器如下所示:

public class ImageConverter : AxHost
{
    public ImageConverter() : base("59EE46BA-677D-4d20-BF10-8D8067CB8B33")
    {
    }

    public static IPictureDisp ImageToPictureDisp(Image image)
    {
        return (IPictureDisp) GetIPictureDispFromPicture(image);
    }
}
我使用的图像是bmp(16*16,8位)。

问题是outlook上下文菜单中没有我的新项目的图像。按钮出现,它执行我希望它执行的操作,但没有显示任何图像。并且没有抛出异常。这是什么?

尝试设置
contextButton.Style=MsoButtonStyle.msoButtonIconAndCaption
尝试设置
contextButton.Style=MsoButtonStyle.msoButtonIconAndCaption