Workaround for VS 2010 Beta 2 Bug: CommandBarButton.Style not honored, always Icon + Caption
Back in VS.NET 2002/2003 the only way to change the style (Icon only, or Icon + Caption) of a CommandBarButton created from a Command was to cast the CommandBarControl returned by Command.AddControl to CommandBarButton and use the CommandBarButton.Style property.
If you use that approach in VS 2010 Beta 2 you will find this bug that I already mentioned:
VS 2010 Beta 2 Bug: CommandBarButton.Style not honored, always Icon + Caption
That means that if the toolbar of your add-in has 30 buttons which should be shown as "only icon", due to this bug they will shown as "icon + caption" and you hardly will see 7 of them...
Fortunately there is a workaround thanks to the EnvDTE80.Commands2.AddNamedCommand2 method that was introduced in VS 2005. So you can:
- Cast the EnvDTE.DTE.Commands (or EnvDTE80.DTE2.Commands) property to EnvDTE80.Commands2
- Call the Commands2.AddNamedCommand2 method passing in the CommandStyleFlags parameter the EnvDTE80.vsCommandStyle.vsCommandStylePict value
I hope this helps.