如何达到 formRegion_FormRegionInitializing 运行时间?

How to reach formRegion_FormRegionInitializing runtime?

您好,我正尝试在 Outlook 2007 运行时 show/hide formRegion。我有 showing/hiding 和 e.Cancel 在 FormRegionFactory_FormRegionInitializing 中,但它仅在用户选择另一封电子邮件时刷新。我如何在运行时到达事件或有更好的方法 showing/hiding 2007 年展望中的区域。

if (Settings.Default.DisplayWhere == "WebBrowser")
{
    e.Cancel = true;
}
else if(Settings.Default.DisplayWhere == "Outlook")
{
    e.Cancel = false;
}

是的,您可以使用 FormRegionInitializing 事件在运行时隐藏窗体区域。有关详细信息,请参阅 How to: Prevent Outlook from Displaying a Form Region

也可以设置FormRegion的Visible 属性 class:

 WindowFormRegionCollection formRegions = 
    Globals.FormRegions
        [Globals.ThisAddIn.Application.ActiveInspector()];
formRegions.FormRegion1.Visible = false;

有关详细信息,请参阅 Accessing a Form Region at Run Time

您可能会发现 MSDN 中的 Creating Outlook Form Regions 部分很有帮助。