Outlook 2007/2010 上下文菜单项图片
我在将图像设置为 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 位)。< br> 问题是 Outlook 上下文菜单中没有我的新项目的图像。按钮出现,它执行了我想要的操作,但没有显示图像。并且不会抛出任何异常。那会是什么?
I have a problem setting an image to the custom context menu item in the outlook. I have a strong requirement to use a custom image, that i was provided.
That's how i'm doing it right now:
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;
}
My image converter looks like this:
public class ImageConverter : AxHost
{
public ImageConverter() : base("59EE46BA-677D-4d20-BF10-8D8067CB8B33")
{
}
public static IPictureDisp ImageToPictureDisp(Image image)
{
return (IPictureDisp) GetIPictureDispFromPicture(image);
}
}
The image i'm using is bmp (16*16, 8 bit).
the problem is that there's no image in the outlook context menu for my new item. The button appears, it does what i want it to do, but no image is shown. And no exception is thrown. What can that be?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试设置contextButton.Style=MsoButtonStyle.msoButtonIconAndCaption
Try set
contextButton.Style=MsoButtonStyle.msoButtonIconAndCaption