I have a custom ribbon which I have to show when a mail selected and also when the mail is opened by double click. 通过双击打开邮件时,我正确放置了按钮。
选择邮件时如何获取功能区?[邮件正文显示在阅读窗格中]。
I have a custom ribbon which I have to show when a mail selected and also when the mail is opened by double click. 通过双击打开邮件时,我正确放置了按钮。
选择邮件时如何获取功能区?[邮件正文显示在阅读窗格中]。
首先,在启动方法中添加一个事件处理程序:
private void ThisAddIn_Startup(object sender, EventArgs e)
{
Application.ActiveExplorer().SelectionChange += activeExplorer_SelectionChange;
}
然后,在事件处理程序中,使用以下命令显示功能区ControlId
:
void activeExplorer_SelectionChange()
{
var ribbon = Globals.Ribbons.YourRibbon;
if (ribbon.RibbonUI != null)
ribbon.RibbonUI.ActivateTab("YourRibbonControlId");
}
您应该ControlId
在功能区的 DesignView 中设置!