【问题标题】:How to capture "Print Tab" click event at the backstage in Outlook 2010 ?如何在 Outlook 2010 后台捕获“打印选项卡”点击事件?
【发布时间】:2015-06-15 16:56:37
【问题描述】:

我想在outlook 2010后台捕获“TabPrint”中的点击事件。

Followint 是我目前所做的

我在 xml 中定义了一个自定义 UI,如下所示。我已将每个事件定向到一个方法(即 OnPrintClick)

 <?xml version="1.0" encoding="utf-8" ?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
  <commands>    
    <!-- Mail print related -->
    <command idMso="FilePrint" onAction="OnPrintClick"/>
    <command idMso="FilePrintCustomRange" onAction="OnPrintClick"/>
    <command idMso="FilePrintPreview" onAction="OnPrintClick"/>
    <command idMso="FilePrintQuick" onAction="OnPrintClick"/>
    <command idMso="GroupPrint" onAction="OnPrintClick"/>
    <command idMso="GroupPrintPreview" onAction="OnPrintClick"/>
    <command idMso="GroupPrintProtectedView" onAction="OnPrintClick"/>
    <command idMso="GroupPrintSettings" onAction="OnPrintClick"/>
    <command idMso="PrintCategory" onAction="OnPrintClick"/>
    <command idMso="PrintDialogAccess" onAction="OnPrintClick"/>
  </commands>
</customUI>

OnPrintClick 方法位于解决方案中的Connect 类中。以下是该方法接受的参数。

 public void OnPrintClick(IRibbonControl control , ref bool cancel)
    {
        MessageBox.Show("PRINT !");
    }

当我执行此代码时,它不会捕获我定义的任何点击事件。我在这里做错了什么吗?任何帮助将不胜感激。

【问题讨论】:

    标签: outlook outlook-addin outlook-2010 office-addins


    【解决方案1】:

    command 标签不会在后台 UI 控件中发挥任何作用。您只能重新调整功能区上的控件(而不是后台)。请参阅Temporarily Repurpose Commands on the Office Fluent Ribbon 了解更多信息。

    一个可能的解决方案是考虑隐藏内置 UI 并使用自定义命令完全重建它。在 MSDN 中的以下系列文章中阅读有关 Backstage UI 的更多信息:

    【讨论】:

    • 谢谢尤金。但是我们如何才能像以前一样重新编程现有的功能呢?
    • 先看看我帖子里提到的文章。
    猜你喜欢
    • 2012-05-05
    • 1970-01-01
    • 2011-03-27
    • 2020-05-29
    • 1970-01-01
    • 1970-01-01
    • 2023-03-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多