【问题标题】:C# VSTO Outlook 2007: Add icon for CommandBarPopupC# VSTO Outlook 2007:为 CommandBarPopup 添加图标
【发布时间】:2011-01-05 16:52:42
【问题描述】:

您好,我想在标准命令栏(如发送和接收按钮)上为我的 CommandBarPopup 按钮添加图像图标。

弹出窗口正在工作,我有带有图标的按钮,但我需要弹出窗口中的顶部图标(在小下拉图标旁边)

创建弹窗的代码:

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

//在弹出窗口中添加按钮就可以了:

            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);

...等等...

但我需要这样的东西:

moznosti.Picture = ... 但没有 Picture 变量(如在 CommandBarButton 对象中)

【问题讨论】:

    标签: c# outlook icons vsto commandbar


    【解决方案1】:

    可能无法将图标添加到CommandBarPopup。至少不使用 VBA。 (如果 vsto 暴露了比 VBA 更多的命令栏模型,我会感到惊讶。)目前我的机器上没有安装 Outlook,所以我无法检查 VBA 的实现,但我几乎可以肯定命令栏模型在所有办公应用程序中都是相同的。使用 Excel 似乎不可能向弹出窗口添加图标。 (刚试过。)

    如果您使用的是 Outlook 2007,为什么不直接调整功能区?组合框或下拉菜单可能会满足您的需求。

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

    【讨论】:

      【解决方案2】:

      是的,尼克是对的。这是不可能的。 CommandBarPopup 是一个容器控件。您可以为子项目添加图标。您也可以在这里找到一些信息

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

      【讨论】:

        猜你喜欢
        • 2011-08-27
        • 2021-12-28
        • 1970-01-01
        • 1970-01-01
        • 2012-03-31
        • 2011-05-28
        • 2018-05-07
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多