-->

Slide animation when showing/hiding CustomTaskPane

2019-06-06 17:58发布

问题:

I have a CustomTaskPane in my VSTO project that I can show/hide using .Visible = true/false property. However it's an ordinary showing/hiding element with no animation whatsoever.

However the "Smart Lookup" button, that comes with Excel 2016, also opens an Excel Pane by sliding left/right.

I guess that the Smart Lookup addin is built in the newer technology using JavaScript instead of the outdated VSTO COM plugin and thus might have such feature.

Am I able to have it in the VSTO plugin as well?

回答1:

It's the default behavior beginning with Excel 2013, that the task panes slide in / out. But this can be disabled in the registry, see Disable Excel 2013 cell animation:

Please check that the registry setting is set to "DisableAnimations = 0"

Then all your custom task panes should be slided in / out when setting visible true / false.



回答2:

To achieve this you need to install KB3114383. With this KB installed, you can disable animations only for Custom Task Panes by changing the following registry key (depending on you your Microsoft Office version: 15.0 = 2013, 16.0 = 2016):

HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Common\Toolbars
HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common\Toolbars

Add the following DWORD value:

DisableWindowTransitionsOnAddinTaskPanes

... and set its value to 1. All other animations, even native task pane (such as Format Chart Area) animations, will remain unchanged. More info here.