开发者

C# VSTO Outlook 2007: Add icon for CommandBarPopup

Hi i want add image icon for my CommandBarPopup button at standard commandbar like Send & Receive Button.

Popup is working, i have Buttons with icons there but I need top icon in popup (next to small dropdown icon)

Code for creating popup:

            moznosti = (Office.CommandBarPopup)standardToolbar.Controls.Add(
                                                    Office.MsoControlType.msoControlPopup,
                                                    System.Reflection.Missing.Value,
                                                    System.Reflection.Missing.Value,
                                                    System.Reflection.Missing.Value,
                                                    true);

// adding buttons to popup is ok:

            nastaveni = (Office.CommandBarButton)moznosti.Controls.Add(1,missing, missing, missing, true);
            nastaveni.Caption = "Na&stavení...";
            global.SetImage(nastaveni, Properties.Resources.settings);
            nastaveni.Style = Office.MsoButtonStyle.msoButtonIconAndCaption;
            nastaveni.Click += new Office._CommandBarButtonEvents_ClickEventHandler(ButtonSettingsClick);

... etc...

but i need something like this:

moznosti.Picture = ... but 开发者_如何学JAVAthere is no Picture variable (like in CommandBarButton object)


It's probably not possible to add an icon to a CommandBarPopup. At least not with VBA. (I'd be surprised if vsto exposed any more of the commandbar model than VBA does.) I don't have Outlook installed on my machine at the moment, so I can't check that implementation of VBA but I'm nearly certain that the commandbar model is the same throughout all office applications. Adding an icon to a popup definitely doesn't seem possible with Excel. (Just tried.)

If you're on Outlook 2007, why don't you just tweek the ribbon instead? A combobox or dropdown might do what you're after.

http://msdn.microsoft.com/en-us/library/bb226712(v=office.12).aspx


Yes, Nick is right. This is not possible. CommandBarPopup is a container control. You can add icon for sub items. Some information you can find also here

http://social.msdn.microsoft.com/Forums/vstudio/en-US/d9e38922-d974-47ee-b758-6002676dcdc6/can-we-add-an-image-to-commandbarpopup-control

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜