如何在Outlook中启用/禁用功能区按钮 [英] How do I enable/disable my Ribbon Buttons in Outlook

查看:278
本文介绍了如何在Outlook中启用/禁用功能区按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用VSTO创建的Outlook加载项.使用功能区设计器,我创建了一个带有三个按钮的选项卡. (环境:Outlook 2010,.NET 4.0,VSTO最新运行时)

I have an Outlook Add-in created with VSTO. Using the Ribbon Designer I have created a tab with three buttons on it. (Environment: Outlook 2010, .NET 4.0, VSTO latest runtime)

按下其中一个按钮时,将打开一个无模式对话框.只要用户正在使用此对话框,我都不希望他能够再次按下该按钮.所以基本上我想将按钮变灰直到对话框关闭.我该怎么办?

When one of the buttons is pressed a modeless dialog is opened. As long as the user is working on this dialog I do not want him to be able to press the button again. So basically I want to gray out the button till the dialog is closed. How can I do this?

无论出于何种原因,在按钮单击处理程序中,如果我执行this.button1.enabled = false;,则该按钮不起作用.我是否对色带的工作方式有所了解?

For whatever reason, in the button click handler, if I do this.button1.enabled = false; it is just not working. Am I missing something about the way ribbons work.

谢谢

推荐答案

您需要使用IRibbonUI.InvalidateControl(controlID)IRibbonUI.Invalidate()重新呈现控件.有关如何动态更新Fluent UI 的信息,请参见MDSN.这样做是出于性能方面的考虑,因此您可以更改所有Fluent UI设置,然后立即重新呈现所有控件更改.但是,如果仅更改一个UI元素(如您所指示的 ),这似乎会造成混淆并且不必要.

You need to re-render the control using IRibbonUI.InvalidateControl(controlID) or IRibbonUI.Invalidate(). See MDSN on how to dynamically update the Fluent UI for reference. This is done for performance reasons so that you can change all your Fluent UI settings and then re-render all control changes at once. However, if you are only changing one UI element (as you indicate) this can seem confusing and unnecessary.

这篇关于如何在Outlook中启用/禁用功能区按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆