How do add an Image(Icon) to a menu Button?

B

B

I have created a COM addin in C++ that adds a couple of
menuButtons(CommandBarButton) to Microsoft Outlook. I have used
commandBarButton->put_Caption() to put the caption on to the button.
Now, I would like to know how exactly would I be able to add an icon or
image to this particular button. Code snippets would be of great help.

Thanks,
B.
 
K

Ken Slovak - [MVP - Outlook]

If you put the image on the Clipboard you can use the PasteFace method of
the button to add the image if the button type is msoButtonIcon or
msoButtonIconAndCaption or one of the other types that supports icons. The
image should be 16x16x256 colors in BMP format to comply with the Office
button image guidelines.
 
K

Ken Slovak - [MVP - Outlook]

Only if you want to use an image that's already used for an existing button.
To use a new image or your own image you have to use PasteFace.
 
D

Dmitry Streblechenko

You can also use CommandBarButton.Picture and Mask properties (Outlook 2002
and up) and set then to an instance of the IPicture COM object.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
K

Ken Slovak - [MVP - Outlook]

True, but if you have to support Outlook 2000 and up that wouldn't work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top