如何聚焦 Outlook 2010 自定义功能区选项卡

发布于 2024-11-10 12:26:59 字数 577 浏览 3 评论 0原文

我有一个自定义 Outlook 2010 功能区选项卡,其类型为 Microsoft.Outlook.Appointment。

在该选项卡中,我有几个按钮可以更改当前约会项目,并调用其 Save 方法。但是,该方法始终将焦点更改为检查器的第一个选项卡。我希望焦点保留在我的自定义选项卡上。

这是我当前的代码:

private void ButtonSaveAppointment(object sender, RibbonControlEventArgs e)
{
    Outlook.Inspector inspector = (Outlook.Inspector)this.Context;
    Outlook.AppointmentItem appointment = (Outlook.AppointmentItem)inspector.CurrentItem;

    appointment.Save();
    this.RibbonUI.ActivateTab(this.Tabs[0].ControlId.ToString());
}

这对我不起作用。谁能告诉我我做错了什么? 谢谢。

I have a custom Outlook 2010 Ribbon tab that has the type Microsoft.Outlook.Appointment.

In that tab, I have several buttons that change the current appointment item, and call its Save method. However, that method always changes the focus to the first tab of the inspector. I want the focus to remain on my custom tab.

Here is my current code:

private void ButtonSaveAppointment(object sender, RibbonControlEventArgs e)
{
    Outlook.Inspector inspector = (Outlook.Inspector)this.Context;
    Outlook.AppointmentItem appointment = (Outlook.AppointmentItem)inspector.CurrentItem;

    appointment.Save();
    this.RibbonUI.ActivateTab(this.Tabs[0].ControlId.ToString());
}

This does not work for me. Can anyone tell me what am i doing wrong?
Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

另类 2024-11-17 12:26:59

这就是我在加载事件中使用的内容:

ThisRibbonCollection ribbonCollection = Globals.Ribbons[_inspector];
ribbonCollection.RibbonSMS.RibbonUI.ActivateTab("the_name_of_the_ribbon_tab");

这与我在代码中看到的内容相对应:

this.RibbonUI.ActivateTab(this.Tabs[0].ControlId.ToString());

该代码在加载事件中很好地触发,但我测试了它,当您从函数调用它时它不起作用。请尝试将其移至加载事件,您将看到代码有效。我的猜测是,它不能从方法正常工作,而只是形成加载事件。

祝你好运

This is what i use in my load event:

ThisRibbonCollection ribbonCollection = Globals.Ribbons[_inspector];
ribbonCollection.RibbonSMS.RibbonUI.ActivateTab("the_name_of_the_ribbon_tab");

And that would correspond to what i see in your code:

this.RibbonUI.ActivateTab(this.Tabs[0].ControlId.ToString());

That code fires well in the load event, but i tested it and it does not work when you are calling it from a function. Please try and move it to the load event and you will see that the code works. My guess is that it does not work properly from a method but just form the load event.

Good luck

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文