This is the second of a series of posts on Visual Studio Add-Ins that I’m writing to record my experiences on creating a plugin for Visual Studio.

Previously, we discussed Adding Items to Context Menus. On this occasion we are looking at how to customise the icon that is displayed.

VS Plugin Default Icon

As you can see from the above image, the default icon is an annoying little smiley face. When you search through the project, you find no reference to this icon, so you are left wondering how to change it.

Well, if you look at the OnConnection method in the Connect class you will see a call to AddNamedCommand2 located within the try/catch block.

The fifth and sixth parameters here are true and 59 by default. This stipulate that we are to use Windows default command bar button faces (true), and that we should use the 59th one (which happens to be a smiley face). Try changing this – you’ll get a different one.

Viewing all these button faces isn’t particularly easy. The MSDN Article Listing Button Faces in the Command Bar for the Microsoft Office System goes into a pretty lengthy explanation on how you might do this. However, we’re just interested in how we’re going to do this for ourselves.

Fortunately, there is another MSDN article How to: Display a Custom Icon on the Add-In Button that details just how to do this. There is little sense in reproducing this information here, so I suggest you follow the steps from the article. 

Tip: Read them all before you start the first one. Some of the steps don’t make any sense until later.

Previous -  Visual Studio Add-Ins – Adding Items to Context Menus.

Next -  Visual Studio Addins – Deactivate and Remove an Add-In.

, , ,
Trackback

only 1 comment untill now

  1. [...] - Visual Studio Add Ins – Changing The Default Icon C#, visual studio, visual studio 2010, visual studio addins Address: [...]

Add your comment now