Transparent images in A2K7 customised ribbon

J

Jon Lewis

I've tried both loading from file and using a table with an attatchment
field but I can't get a custom ribbon to accept ico or png pictures as
Button images. BMPs and JPGs only. I get either an invalid image error or
no error and a blank button image. These same files will load quite happily
into an image control on a form. Several articles on msdn infer that ico
and png files are supported but all Access custom ribbon examples that I can
find use BMPs. This is a pretty major defect if the ribbon does not support
transparency of custom images.

Anyone else noticed this or am I missing something?
 
J

Jon Lewis

The problem seems to be not that the ribbon doesn't support PNGs but how to
create a IPictureDisp to pass to the ribbon. LoadPicture does not seem to
support PNGs and from an attachment control
Set image = frmRibbonImages.Images.PictureDisp doesn't work if the stored
image is a PNG.

This is despite MSDN saying that LoadPicture will load a PNG and that PNGs
are the prefered format for a Ribbon Button image.
 
A

Anthos

Jon,
I also have found that I am unable to use PNG files as Ribbon Images.
Instead I have resorted to using BMP files with transparancies for the
Ribbon.

My Solution is loading them from a Table with the Images stored as
attachments.

The Application I use to create the transparent backgrounds in bmp
files is IcoFX
(freeware from: http://icofx.xhost.ro/)

The Error Event I am getting when trying to load PNG files is "Image
format not supported"
 
J

Jon Lewis

Hi Anthony. I actually tried using icon files (known good ones) and had
problems in that whilst Loading OK some were interpreted as totally
transparent (i.e. all blank) by the ribbon.

I think it's absolutely ludicrous that MS states that the prefered format
for custom ribbon images is png and then provides no way to load them (even
stating in an MSDN article that the stdole LoadPicture supports png files
when it doesn't).

If you're comfortable using the Windows API and in particular the GDI+
library, there are 2 solutions I found if you want to use PNGs (which are
better than ICOs as for example the ribbon can automatically handle fading
the image when a ribbon button is disabled).

LoadPictureGDI.zip from http://www.oaltd.co.uk/Excel/
which allows you to load a png file from disk (you can use the built in
SavePicture function to create the file from a stored Attachment) or better
still:

ImageInRibbon from http://www.accessribbon.de/en/index.php?Downloads:5
which doesn't require the png to be saved to disk first

http://www.accessribbon.de/en/index.php?Welcome
is a great ribbon resource site btw

HTH

Jon
 

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