Converting PNG image to IPicture for Ribbon?

  • Thread starter Robert Cottigham
  • Start date
R

Robert Cottigham

Background: I am a bit new to VBA and working with Access 2007 SP2. I am
tring to avoid an addin (e.g. managed code solutions) as I would like to just
be able to deliver the database to the clients without a bunch of DLLs, etc.
Basically, I have a table of images that I wish to load into the Office 2007
Ribbon. For a variety of reasons (including alpha channel support and a
library of images), I have to use PNG images. Now, VBA seems to despise PNG
images (e.g. LoadImage will not work with it). This causes me to have to use
GDI+ to convert the PNG images to IPicture for the ribbon. Now, I have this
working with files sitting on the disk by using the GdipCreateBitmapFromFile
function. But, it really seems sloppy to take an PNG attachment, write it out
to disk and then read it back in. I would like to convert the PNG image
directly to a IPicture in my code without going out to disk.

Question: Does anyone know how to convert a PNG image stored as an
attachment in an Access 2007 table to IPicture without writing the file out
to disk? I am guessing that it might involve the GdipCreateBitmapFromStream
function. But, I have no clue how to turn my PNG attachment into a "stream"
so I can pass it to this function.

Any assistance or advice would be greatly appreciated.
 
J

Jeanette Cunningham

Hi Robert,
have a look at this
http://www.accessribbon.de/en/index.php?Downloads

This is where I got all my info about using png images in the ribbon.
In particular download sample number 5.

5. Sample database IconInRibbon

This sample shows how to use own image files in a Ribbon, without prior
copying these into the file system.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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