Visual Studio and .NET Framework Home
Wrong default vsCommandStyle for CommandBarButtons created from add-ins
Carlos J. Quintero
as Won't Fix
8/23/2007 2:07:52 AM
User(s) can reproduce this bug
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.
Visual Studio 2005 (All Products and Editions) Service Pack 1
Windows XP Professional
Operating System Language
Steps to Reproduce
Create a VB.NET add-in with the attached Connect.vb class.
1) The button on the "Standard" toolbar shows picture + text.
2) The button on the "Tools" menu does not show picture
1) The button on the "Standard" toolbar shows only picture.
2) The button on the "Tools" menu shows picture + text
TAP Code (if applicable)
You can indicate your satisfaction with how Microsoft handled this issue by completing this quick
3 question survey
to post a comment.
Please enter a comment.
on 8/30/2007 at 4:16 PM
Thank you for your feedback. We are not seeing all of the symptoms described in the upcoming release of Visual Studio (Codename Orcas), but are seeing some. It is too late to get fixes for this in the upcoming release though, and we will consider this for future releases.
Visual Studio Platform Team.
on 8/23/2007 at 4:41 PM
Thanks for your feedback. We have reproduced this bug on Visual Studio 2008 Beta 2, and we are sending this bug to the appropriate group within the VisualStudio Product Team for triage and resolution.
Visual Studio Product Team.
to post a workaround.
Please enter a workaround.
© 2014 Microsoft