MZ-Tools Articles Series: HOWTO: Set the default style a CommandBarButton on a toolbar from a Visual Studio add-in.
When a CommandBarButton is created from a Command on a Visual Studio menu, it
has an icon and a text. However, when it is created on a toolbar, it can have
only an icon, or an icon and a text. Typically buttons on a toolbar have only an
icon (without a text). There are two ways to set that style (only the icon) to a
CommandBarButton on a toolbar:
- Setting the CommandBarButton.Style = MsoButtonStyle.msoButtonIcon. This
approach has the drawback that Visual Studio first creates the button with icon
and text, and then it changes it to icon only.
- Setting the default style of a command to
EnvDTE80.vsCommandStyle.vsCommandStylePict, so that CommandBarButtons created on
toolbars have only the icon, while those created on menus have icon with text
(the only possible style for them).
My latest article shows a sample of the second approach:
HOWTO: Set the default style a CommandBarButton on a toolbar from a Visual Studio add-in.