【问题标题】:VSTO Outlook: Avoid closing custom task paneVSTO Outlook:避免关闭自定义任务窗格
【发布时间】:2022-11-01 05:17:02
【问题描述】:

我有一个自定义任务窗格,现在我正在尝试捕获自定义任务窗格的关闭事件。我已经看到没有这样的事件,而是有一个完全一样的 VisibleChanged 事件,它在可见性改变或关闭时引发。

当用户单击关闭按钮或从上下文菜单中选择关闭时,我想显示一个消息框,说明不允许关闭它并且不允许用户关闭它。

我已经看到herethis 用户线程的方法,但这会导致再次显示时闪烁(您可以看到它被隐藏,然后很快再次可见)。有没有其他方法可以实现这一目标?此外,在这些方法中显示消息框的最佳位置在哪里?

【问题讨论】:

    标签: outlook vsto outlook-addin office-addins customtaskpane


    【解决方案1】:

    自定义任务窗格不提供在窗格即将关闭时触发的任何事件。完成工作没有简单的方法,您需要实施论坛主题中描述的解决方法。您也可以考虑改用Advanced Outlook view and form regions

    请注意,Outlook 表单区域提供以下现成的事件:

    Event Description
    FormRegionInitializing Occurs before the form region is initialized. You can check conditions in this event handler to determine whether Outlook should display the form region. For more information, see How to: Prevent Outlook from displaying a form region.
    FormRegionShowing Occurs after an instance of the form region is created but before the form region appears.
    FormRegionClosed Occurs before the form region is closed.

    【讨论】:

    • 是的,但是您不能将表单区域放在顶部;)
    • Advanced 可以放置表单,这与 Outlook 表单区域不同。
    • 但是要使用高级表单,我需要使用 Add-in Express 第三方工具,对吗?我不想依赖第三方工具。
    • 如果您不想依赖第三方组件,则需要学习 Windows API 函数并准备好花费大量时间来实现变通方法。这完全是你的选择!
    • 是的。世界并不理想,尤其是在创建 MS Office 插件方面。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-11-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-04
    • 2022-08-11
    • 1970-01-01
    • 2010-11-10
    相关资源
    最近更新 更多