Scott Lundberg
Scott Lundberg

Reputation: 445

Retaining Alpha channel on buttons in Outlook Toolbar

I am developing a COM Add-in using VB.NET in Visual Studio 2008 Pro for Outlook 2003 and am having trouble assigning images to custom toolbar buttons.

In a nutshell, I am having to convert from an Icon type to a stdole.IPictureDisp type so that I can assign my buttons a picture.

The picture displays, but it loses the Alpha channel and the background is no longer transparent. I can verify that before the conversion to IPictureDisp object, that the PixelFormat property is set to Format32bppArgb (2498570). I am using a coding technique suggested here: http://msdn.microsoft.com/en-us/library/ms268747%28VS.80%29.aspx.

For C# users, this link blogs.msdn.com/andreww/archive/2007/10/10/preserving-the-alpha-channel-when-converting-images.aspx (sorry I am newbie and can't post more than one link! Dumb rule BTW) shows how to modify the IPictureDisp one pixel at a time and rebuild the transparency, but I can't find similar functions in VB.NET...

I would appreciate any advice regarding this. Thanks.

Upvotes: 0

Views: 499

Answers (1)

Joe Caffeine
Joe Caffeine

Reputation: 878

If you read to end of the article the author notes in one of the comments that the command bars API doesnt support alpha channels on images. You can of course cheat a little, if you draw your image onto a bitmap that matches the background of the toolbar and assign that composite image to the toolbar button, you would have a toolbar image that "looks" transparent.

Upvotes: 0

Related Questions