Customize Your Toolbars in Visual Studio 2010: Commands Tab
Menu: Tools->Customize
Command: Tools.Customize
Versions: 2010
Published: 7/29/2010
Code: vstipEnv0031
You can customize any toolbar in Visual Studio 2010. Just click on the drop-down to the right of any toolbar then click on "Add or Remove Buttons":
Then click on "Customize":
Alternatively, you can go to Tools -> Customize on the Menu Bar:
Whichever option you choose, you will get the Customize Dialog:
We've already explored the Toolbars Tab in vstipEnv0030 so click on the Commands Tab:
As you can see this is a fairly complex beast so let's break it down into its parts as we do an example. First is the choice of menu or toolbar to modify. In this case I will choose the Editor Context Menu you see when you RIGHT CLICK while writing code:
Next, is the Controls area that shows the items on the menu or toolbar you have chosen to modify. For our example, it shows the items available when we RIGHT CLICK in a code window:
Remember that not all the items you see are available all the time as these items only show up in the proper context. So while there are a billion buttons currently available, when I RIGHT CLICK in my code window this is all I currently see:
Finally, there is the workhorse area of the dialog that has all the buttons that actually DO stuff:
Add Command-let's you add a new item to the existing menu or toolbar.
Add New Menu-creates a new menu in the existing menu or toolbar.
Delete-removes the current item from the Controls area.
Move [Up or Down] -changes the location of the item in the Controls area.
Modify Selection-allows you to make changes to the existing item in the Controls Area such as resetting it back to default settings, changing the name, and text visibility. Additionally, it has the ability to make a new group on the menu or toolbar.
Reset All-will reset every item in the Controls area to its default settings. Particularly useful if you have made a lot of changes.
Okay, so getting back to our example. We want to add the comment and uncomment buttons to the context menu so I can use them when I select some code and RIGHT CLICK. First I click on the Add Command button which brings up the Add Command dialog:
Now I need to locate where the comment and uncomment items are located. How would I do this? Well the best path is usually to see if the item can be found on a menu somewhere and use that as a clue:
Since I see that the items I want are off the Edit Menu then I can search there first. Unfortunately, the items we want are now called "Selection Comment" and "Selection Uncomment":
Find each one of these items and click OK to add them to the Controls list:
I think it would be cool to have these buttons in their own group so I will select the item ABOVE which I would like the group line to be ("Marker Commands" in this case) then click on Modify Selection and choose "Begin a Group":
This creates a new group line and now my commands are in their own group:
That's it! Just I just click on the Close button and go to any code area. Select some code and RIGHT CLICK and select Comment Selection:
It works like a charm and you are all set to begin making your own modifications as you want to your environment:
Comments
Anonymous
July 28, 2010
The Add Command dialog desperately needs a way to search or filter the commands. (At least VS2010 has made it resizable, by the look of it the screenshots.) (A couple of days ago I spent ages looking for a command that was in VS2005 but seems to have been removed in VS2008. Gave up looking after several minutes searching different categories and the long lists within them. If I could have just typed "Word" (to find the toggle for Find Full Words, if it still exists) it would've taken seconds to find the item or realise it was gone.)Anonymous
July 28, 2010
The comment has been removedAnonymous
July 30, 2010
Why did Microsoft remove drag/drop toolbar and menu customization in VS 2010? It's so frustrating and time consuming to rearrange and add or remove commands now!!!Anonymous
August 02, 2010
@PBR :) I suspect is was a victim of the complete rewrite of VS into WPF. As time goes on it may resurface but probably didn't make the cut for this version. ZAnonymous
September 05, 2010
It would be great if the option to display the commands as image-only was brought back. At the moment, if you have anything without a default image, all you can do is have a text label. In earlier versions you could just show the image, which you could edit yourself.Anonymous
May 15, 2011
It was discouraging to see that customisations didn't get through to Visual Studio 2010 and even the recent SP1 also didn't bring them back. Of course new WPF capabilities are wonderful, but also lacking at times when you're get used to some of them from 2005/2008. Of course there are trade-offs to be made but come on, if not in SP1 then when (if ever) we'll get it back?Anonymous
May 15, 2011
Krzysztof :) I know that some features didn't make the cut because of the rewrite but, as each new version comes out, we will see more great things because of the rewrite. Also, I know the VS team has a long list of previous features they are working to get back into the product. Personally, I'm willing to take a hit on toolbar customization (which I don't do very often) so I can have the enhanced features in the Breakpoints window (search, labels, etc...). ZAnonymous
March 21, 2014
The comment has been removedAnonymous
March 21, 2014
blogs.msdn.com/.../create-a-shortcut-key-for-a-macro-vstiptool0066.aspx