簡體   English   中英

Outlook 2007/2010上下文菜單項圖片

[英]Outlook 2007/2010 context menu item picture

我在將圖像設置為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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM