Reputation: 1848
I've programmed an add-in for VS2010, one of the code-lines from this add-in is:
Command command = commands.AddNamedCommand2(
_addInInstance, "MyAddIn", "MyAddIn",
"bladiebla", true, 59, ref contextGUIDS,
(int)vsCommandStatus.vsCommandStatusSupported
+ (int)vsCommandStatus.vsCommandStatusEnabled,
(int)vsCommandStyle.vsCommandStylePictAndText,
vsCommandControlType.vsCommandControlTypeButton);
The number 59 is the code of the icon to use. Somehow when you use the number 59, a smiley appears as icon. Some testing did show that 47 shows an eraser, and 58 shows a x2-sign.
One question is where those icons come from? Another question is how to add my own icon. I tried:
var bitmap = new Bitmap(@"c:\myicon.ico");
and replace the number 59 with the bitmap object (this should be possible because the parameter for that function requests an object. But this did not work.
Upvotes: 1
Views: 1363
Reputation: 1910
Look at my bookmarks, these references should be of use to you:
For information about how to find the ID numbers for standard icons, see Listing Button Faces in the Command Bar for the Microsoft Office System on the MSDN Web site.
How to: Change the Default Icon for an Add-In
ref: http://msdn.microsoft.com/en-us/library/ms165626(v=VS.100).aspx
How to: Display a Custom Icon on the Add-In Button
ref: http://msdn.microsoft.com/en-us/library/ms228771.aspx
Upvotes: 2