When an add-in creates a CommandBarButton from a command using EnvDTE.Command.AddControl(...), one would expect a default style as follows:
- For toolbars, only picture (without text)
- For menus, picture + text
The EnvDTE80.Commands2.AddNamedCommand2 function allows to specify (or not) the default style for buttons created for that commands in the optional CommandStyle parameter, but it happens the following:
- If you don't supply it (you can do it because it is not mandatory), then buttons created on a toolbar shows not only picture but also text. This is not desirable, since on a toolbar most buttons show only picture without text.
- If you supply it with the value vsCommandStyle.vsCommandStylePict, then buttons created on a menu shows text (which of course makes sense), but it does not show the picture!
The bottom line: you are forced to cast the CommandBarControl returned by Command.AddControl to CommandBarButton and then adjust the CommandBarButton.Style property. It would be very helpful if you could avoid this step since Visual Studio extensibility is hard and these things don't contribute to make it easy. Furthermore, forcing that step in an add-in with dozens of buttons causes a small delay during the loading of the add-in that could be avoided.
I suggest two easy solutions:
1) Add a vsCommandStyle.vsCommandStyleAutomatic enum value and figure out the best style: Picture+Text on commandbars that are menus and only picture on commandbars that are toolbars.
2) If it is too late to add such value, make that when you don't supply the vsCommandStyle parameter value to behave in that "automatic" guessing.