Refresh the Office Ribbon UI while the window is i

2019-08-15 07:13发布

问题:

I am working on a Office Ribbon project. (PowerPoint)

A label on it is being periodically updated from a timer. (It is displaying the current number of connections to our server)

When the PowerPoint window is in focus, the label is updated correctly. However, when the window is inactive, the updates are suspended. (they appear only after the PowerPoint window receives focus)

This is an issue for multi-monitor setups, or when snapping PowerPoint to a half of the screen - we need correct data to be displayed.

I understand that the idea behind this is to lower the CPU load, but I would like to override the behavior.

I tried the Invalidate, PerformLayout and similar methods, but can't get the ribbon to refresh. Is there any way to do this?

回答1:

Nope. There is no way to update the Fluent UI in all windows. The callbacks are invoked when the window becomes active.

You may consider creating Custom Task Panes for such needs. In that case you will be able to control each instance separately and update the UI at runtime. You may find the following articles helpful:

  • Walkthrough: Automating an Application from a Custom Task Pane
  • Managing Custom Task Panes in Multiple Application Windows