Is it possible to display a custom icon in the Visual Studio status bar

I am aware of displaying custom text in the Visual Studio status bar using the IVSStatusBar interface. I even blog about it.

However, I have a requirement to display a custom icon in the Visual Studio status bar. Similar to what Resharper does to display solution errors. Clicking on the icon also brings up a context menu.

Resharper icon

So, How can I display a custom icon in the Visual Studio status bar and, if possible, display the menu and click it? ... An example will help.

The animation method IVSStatusBar already displays icons, but uses the predefined icons defined in Constants . Is it possible to have custom icons and go to animation method?

While researching the SDK, I found that the IVSStatusBarUser interface can be used to display user information when a window that implements that interface is displayed, but I'm not sure if this interface can be used to display a custom icon.


source to share

1 answer

There is no published API to extend status bar extensibility. In one of my own extensions (PerfWatson Monitor) I am detecting a status bar element by browsing the WPF visual tree using recursive search and VisualTreeHelper

going down from Application.Current.MainWindow

looking for a resize capture in the bottom right - a child with the property Name

set to "ResizeGripControl"

. When I find a capture, I look at its parent (it should beDockPanel

) and paste my control there. Note that as your screenshot shows, Resharper is known to use a similar trick, so you'll have to develop a strategy that works with and without Resharper installed. Also note that some parts of the status bar (text, line / column information, and any animations) run on their own UI thread, so be careful if your control ends there.

I notice that you are also asking about extending existing animations. Yes, you can provide your own animations via the 16x16 frames bitmap. See for an example. Unfortunately, this will not allow the use of the interactive menu.



All Articles