VSTO:刷新Outlook2010功能区按钮控件标签
我正在创建一个 Outlook2010 加载项,它将显示一个文件夹中有多少电子邮件,我们称之为 foo,它有许多子文件夹(在功能区加载期间,我聚合了 foo 及其子文件夹中的所有项目计数。我没有但是,如果用户将电子邮件从收件箱拖放到 foo 文件夹或其任何子文件夹中,反之亦然,则自定义功能区上的项目计数将不会反映
。但我没有让它启动,而且因为用户可以在 foo 下创建任意数量的子文件夹,我认为 beforeitemmove 事件不起作用。
有没有办法更新功能区控件(按钮)。
I'm creating a Outlook2010 add-in that will display how many email in a folder let's call it foo and it have many sub folders (During ribbon load, i have aggregated all the item count from foo and its sub folders. I have no problem with this part. However, if a user drag and drop a email from let's say Inbox into foo folder or any of its sub folder or vice versa then the item count on the custom ribbon will not reflect.
I tried to use folder beforeitemmove event but i wasn't get it to fire and also since user can create as many sub folder under foo as they want. I don't think beforeitemmove event will work.
Is there a way to update a ribbon control (button)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/9da68794-a026-49b7-b919-651dc231846c/
调用 invalidate 可能有效吗?
http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/9da68794-a026-49b7-b919-651dc231846c/
Calling invalidate might work?
对于 Word,我刚刚发现,调用 Office::IRibbonUI::Invalidate() 会产生 GDI 对象泄漏。对于我的所有功能区按钮,都会调用相应的 getImage 回调。看来 Word 没有释放旧图像。
我还没有找到一种动态启用/禁用功能区按钮的方法。
For Word I just found, that calling Office::IRibbonUI::Invalidate() produces a GDI object leak. For all of my ribbon buttons, the corresponding getImage callback is invoked. It appears that Word does not free the old images.
I have not yet found a way for enabling / disabling ribbon buttons on the fly.
是的,作品无效。但是,当与按钮的 getImage 回调结合使用时,这将泄漏 GDI 对象(每个按钮每次刷新 2 个 GDI 对象)。
我刚刚得到工作代码:
使用全局加载图像回调:
定义为:
STDMETHOD(OnLoadImage)(BSTR imageName, IPictureDisp** ppdispImage);
分别。
看来,当通过全局 loadImage 回调加载图像时,没有资源泄漏。但是,当通过按钮的 getImage 回调加载图像时,新图像已正确加载,但我获得了 GDI 对象泄漏。
Yes, invalidate works. But when used in combination with a getImage callback for a button, this will leak GDI objects (2 GDI objects per refresh per button).
I just got working code though:
Use a global load image callback:
Defined as:
STDMETHOD(OnLoadImage)(BSTR imageName, IPictureDisp** ppdispImage);
resp.
It appears, that when the image is loaded via the global loadImage callback, there is no resource leak. But when the image is loaded by the getImage callback of a button, the new image is correctly loaded but I earn a GDI object leak.