加载色带时更改色带中的按钮
我为 Outlook 2007 AppointmentItem 创建了一个自定义功能区。 AppointmentItem 可以具有自定义属性。设置自定义属性后,应禁用自定义功能区中的按钮(默认情况下启用)。
我在自定义功能区中尝试了 _Load 函数,但该按钮仍然处于启用状态。我可以调试它:字符串已填充并且按钮将被禁用,但在前端没有任何反应。
public partial class Ribbon1 {
[...]
private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
{
if (myCustomProperty != "")
{
Globals.Ribbons[Globals.ThisAddIn.Application.ActiveInspector()]
.Ribbon1.buttonCollaborate.Enabled = false;
}
}
[...]
}
我不知道出了什么问题,可能是 Globals.Ribbons[...].Ribbon1
不是当前的 Ribbon?或者有ribbon_load_finish_method吗?
我使用了 VisualStudio 2010 和 .Net 3.5
感谢您的宝贵时间!
I created a custom Ribbon for an Outlook 2007 AppointmentItem. The AppointmentItem can have a custom property. When the custom property is set, a button in the custom Ribbon should be disabled (by default it is enabled).
I tried the _Load function in my custom Ribbon, but the button is still enabled. I can debug it: the string is filled and the button will be disabled, but in the frontend nothing happens.
public partial class Ribbon1 {
[...]
private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
{
if (myCustomProperty != "")
{
Globals.Ribbons[Globals.ThisAddIn.Application.ActiveInspector()]
.Ribbon1.buttonCollaborate.Enabled = false;
}
}
[...]
}
I don't know whats wrong, may be Globals.Ribbons[...].Ribbon1
is not the current Ribbon? Or is there a ribbon_load_finish_method?
I used VisualStudio 2010 and .Net 3.5
Thanks for your time!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么要经历所有这些繁琐的事情?不久前我不得不写一些类似的东西(对于邮件项目,而不是约会),需要根据注册表项设置一个按钮。这就是我的方法。我并不是说它是完美的,但它对我有用。
这是我的(草率的)代码的片段:
Why go through all the rigamarole? I had to write something similar a while back (for a mail item, not appointment) that required a button to be set based on a registry entry. This was my approach. I'm not saying it's perfect, but it worked for me.
Here's a snippet from my (sloppy) code: