Problem Using Icon with Clear Background

J

jaredb

I'm creating an Outlook 2007 addin using VSTO and I'm trying to use an icon
as the image on CommandBarButton objects. My icon is of a circle that has a
clear background, but it doesn't seem to work. When I try to use the
PictureDispConverter class that is used in many of the examples, the icon is
converted, but I get a COM error when assigning it to
CommandBarButton.Picture saying that the value is outside the expected range.


If I try to convert the to a bitmap, I loose the clear background.

Does anyone know why my converted icon wouldn't be working, or have any
suggestions of how to create/use my clear background icon?

Thanks,
Jared
 
K

Ken Slovak - [MVP - Outlook]

Use a PNG file with its full transparency layer. I've had best results using
that format. Second choice is a BMP with transparency. Icons don't have a
transparent layer.
 
J

jaredb

I've tried using both PNG and GIF with transparency, but Outlook always
draws them with a dark blue background when in a CommandBarButton. Do you
know if there is a setting that makes it draw that dark blue background?

Thanks,
Jared
 
K

Ken Slovak - [MVP - Outlook]

Sorry, I didn't notice that was for a command bar button. For that you need
2 separate images, one of the main image and the other the mask for the
transparency. You assign the main image as an IPictureDisp object to
button.Picture and the mask in the same format to button.Mask.
 
J

jaredb

That explains it.

Thanks!

Ken Slovak - said:
Sorry, I didn't notice that was for a command bar button. For that you need
2 separate images, one of the main image and the other the mask for the
transparency. You assign the main image as an IPictureDisp object to
button.Picture and the mask in the same format to button.Mask.
 

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