Go Back   Access World Forums > Microsoft Access Discussion > General

 
Reply
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
Old 07-08-2009, 09:17 PM   #1
ListO
Seņor Member
 
ListO's Avatar
 
Join Date: Feb 2000
Location: Hollyweird, California
Posts: 155
Thanks: 2
Thanked 0 Times in 0 Posts
ListO is on a distinguished road
Which image formats to use with ribbon buttons?

I'm trying to add my own images to buttons I'm adding to a custom ribbon in Access 2007.

I've done fine adding .jpg or .bmp images, but I would like to utilize transparencies for these images so they'll look pretty.

Although Microsoft's MSDN information says to use .png files, they don't seem to work: I get a "Runtime Error '481' - Invalid Picture" in the OnLoadImage code if I try to use that format.

If I use a .gif in which I've set a particular color as the transparency color, that image opens and displays, but with the so-called transparency color showing.

Questions:
Do I need to do something differently to use a .png file rather than .jpg? MS recommends it, but it doesn't seem to work.

Is there a better or different image format that I SHOULD be using?

Thanks for the help.

ListO is offline   Reply With Quote
Old 07-08-2009, 10:00 PM   #2
Dezirous
Rafi Ahmed
 
Dezirous's Avatar
 
Join Date: Jul 2009
Location: Karachi, Pakistan.
Posts: 71
Thanks: 2
Thanked 0 Times in 0 Posts
Dezirous is on a distinguished road
Re: Which image formats to use with ribbon buttons?

Well, GIF is the chipest and lightest format of image which supports transparency. I will suggest you to use adobe photoshop or any advance image editor and and set transp. color to WHITE. It will be better then other color. Just try it.
Dezirous is offline   Reply With Quote
Old 07-09-2009, 08:09 AM   #3
ListO
Seņor Member
 
ListO's Avatar
 
Join Date: Feb 2000
Location: Hollyweird, California
Posts: 155
Thanks: 2
Thanked 0 Times in 0 Posts
ListO is on a distinguished road
Re: Which image formats to use with ribbon buttons?

Thanks for the help, but I have tried just what you suggest. Although the .gif images I make have their transparencies set correctly, the transparent colors are not transparent in the ribbon. They are transparent when opened in MS Photo Editor or when viewed as thumbnails in the explorer.

ListO is offline   Reply With Quote
Old 07-21-2009, 11:00 PM   #4
ListO
Seņor Member
 
ListO's Avatar
 
Join Date: Feb 2000
Location: Hollyweird, California
Posts: 155
Thanks: 2
Thanked 0 Times in 0 Posts
ListO is on a distinguished road
Re: Which image formats to use with ribbon buttons?

Am I the only person here having this problem?

A long internet search reveals a few others out there with similar problems, and a couple of solutions which involve some very complicated coding to force Access to recognize certain colors as transparent.

Have any of you successfully used .png files for ribbon images? Access seems not to recognize that format as valid on my system.

Have any of you successfully used transparency colors with .gif files? My images appear, but with the transparency color showing.
ListO is offline   Reply With Quote
Old 07-23-2009, 07:03 PM   #5
Dezirous
Rafi Ahmed
 
Dezirous's Avatar
 
Join Date: Jul 2009
Location: Karachi, Pakistan.
Posts: 71
Thanks: 2
Thanked 0 Times in 0 Posts
Dezirous is on a distinguished road
Re: Which image formats to use with ribbon buttons?

Ok........ lets analyze first........ Access cannot recognize PNG format for transparency... If Access is unable to apply transparency with GIF, then is there any grantee that PNG will work as transparent.... if Access supports transparency....... then it work with GIF too..... there could be a simple solution.... capture the color of your button face....... apply this to your image background........ it will look like transparent if you dont change your windows theme......
Dezirous is offline   Reply With Quote
Old 07-24-2009, 12:05 PM   #6
NigelShaw
Newly Registered User
 
NigelShaw's Avatar
 
Join Date: Jan 2008
Location: Leicester UK
Posts: 1,564
Thanks: 8
Thanked 71 Times in 47 Posts
NigelShaw is on a distinguished road
Re: Which image formats to use with ribbon buttons?

Hi

unless in using using animation, I alwUs use png. My access supports the transparency. Infact my ribbonX book advises you use png for the transparency factor in case the theme colours are changed.

Gif are less quality

I'd always use a png
__________________
Never, ever, argue with an idiot. They'll drag you down to their level and beat you to death with experience!

If i have helped you in any way, please tip my scales or say a little thanks
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Chars

Checkout my splash screen tool
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
for a free download.
NigelShaw is offline   Reply With Quote
Old 07-24-2009, 06:50 PM   #7
Dezirous
Rafi Ahmed
 
Dezirous's Avatar
 
Join Date: Jul 2009
Location: Karachi, Pakistan.
Posts: 71
Thanks: 2
Thanked 0 Times in 0 Posts
Dezirous is on a distinguished road
Re: Which image formats to use with ribbon buttons?

Yes, you are right.... but PNG format are use where transparency & shadow are required, and GIF is less quality.... but if you use adobe photoshop to make GIF, it will give you option for quality like 50%, 80% even 100%. Just for try... you can use GIF. The question raises if Access supports transparency, then why it is supporting PNG which is the major format for high quality image? I'll advise you to use GIF just for your current ribbon.

Dezirous is offline   Reply With Quote
Old 07-27-2009, 02:39 AM   #8
darbid
Newly Registered User
 
Join Date: Jun 2008
Location: Munich
Posts: 1,428
Thanks: 6
Thanked 38 Times in 35 Posts
darbid will become famous soon enough
Re: Which image formats to use with ribbon buttons?

Quote:
Originally Posted by ListO View Post
Am I the only person here having this problem?
ListO have you still got a problem?

How are you currently adding the button?

I have ZERO experience with Access 2007 but have gone through this process with adding my one transparent image in 2003.

I am aware of three methods to add transparent images, but for me only Nr.3 worked properly and I think is the only one of these that you can use with VBA the others would need VB6

Method 1 http://support.microsoft.com/kb/288771 (in some languages)

Method 2 http://www.codeguru.com/vb/gen/vb_ge...icle.php/c3237

Method 3
Code:
Dim myOCB As Office.CommandBar
Dim myOCBBTools As Office.CommandBarPopup
Dim myPIC As stdole.IPictureDisp
Dim myMASK As stdole.IPictureDisp

Set myPIC = LoadPicture("path to your image")
Set myMASK = LoadPicture("path to your mask image")
Set myOCB = Application.CommandBars("Menu Bar")
Set myOCBBTools = myOCB.Controls("&Tools")

'<ADD A NEW BUTTON>
Set myOCBBCustom = myOCBBTools.Controls.Add(msoControlButton, 1, , , True) 

With myOCBBCustom                                                        
    .Caption = "Hello"
    .Enabled = True
    .Picture =  myPIC
    .Mask = myMASK
    .Visible = True
End With

'myOCB.Reset '<TO RESET THE COMMANDBAR>
Does this look familiar to you.

To get your masked image open your .bmp image in paint and just make any non-transparent part of the image black.
darbid is offline   Reply With Quote
Old 07-27-2009, 03:35 AM   #9
NigelShaw
Newly Registered User
 
NigelShaw's Avatar
 
Join Date: Jan 2008
Location: Leicester UK
Posts: 1,564
Thanks: 8
Thanked 71 Times in 47 Posts
NigelShaw is on a distinguished road
Re: Which image formats to use with ribbon buttons?

Hi,

here is a ribbon example XML-
Code:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
   onLoad="rxIRibbonUI_onLoad">
   <ribbon startFromScratch="false">
    <tabs>
     <tab 
      id="rxtab" 
      label="My Custom Tab" 
      insertBeforeMso="TabHomeAccess">

      <group
       id="rxgrp"
       label="Custom Group">

       <toggleButton
        id="rxtgl"
        label="Custom Button" 
        getImage="rxtgl_getImage" 
        size="large"
        onAction="rxtgl_Click" />

      </group>
     </tab>
    </tabs>
   </ribbon>
</customUI>
the line in red is the part that gets the image. it calls the GetImage routine to collect and place the image when the ribbon starts.

i have also attached a sample db that will show how this works. you will need to import both modules from the example into your db if you want to use this method.
The example is on a toggleButton but the same method of getting the image is similar, you just need to remove the "If" scenario for the OnClick request.

Hth


Nigel
Attached Files
File Type: zip Ribbon GetImage Example.zip (177.0 KB, 674 views)
__________________
Never, ever, argue with an idiot. They'll drag you down to their level and beat you to death with experience!

If i have helped you in any way, please tip my scales or say a little thanks
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Chars

Checkout my splash screen tool
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
for a free download.
NigelShaw is offline   Reply With Quote
The Following User Says Thank You to NigelShaw For This Useful Post:
Acke (09-11-2019)
Old 09-15-2019, 07:59 AM   #10
Acke
Newly Registered User
 
Join Date: Jul 2006
Posts: 105
Thanks: 90
Thanked 1 Time in 1 Post
Acke is on a distinguished road
Re: Which image formats to use with ribbon buttons?

Hi,

Sample database NigelShaw posted works perfectly on 2016 office machine. Not working on 2010 office computer.

Checked preferences, the same set active on both computers.

I am receiving the follwing message: "Microsoft Access cannot run the macro of callback function >name of the function<. Make sure the macro or function exists and takes the correct parameters."

Image does not apear on the button as it should.

What should I do to make it work on 2010 office device?

Thanks!
Acke is offline   Reply With Quote
Old 09-15-2019, 09:34 AM   #11
arnelgp
error reading drive A:
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,568
Thanks: 68
Thanked 2,744 Times in 2,629 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Which image formats to use with ribbon buttons?

did you add Reference to Microsoft Office XX.X Object Library?
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
The Following User Says Thank You to arnelgp For This Useful Post:
Acke (09-17-2019)
Old 09-21-2019, 12:26 PM   #12
Acke
Newly Registered User
 
Join Date: Jul 2006
Posts: 105
Thanks: 90
Thanked 1 Time in 1 Post
Acke is on a distinguished road
Re: Which image formats to use with ribbon buttons?

Thanks guys and sorry for the slow response.

I've checked the references. The only difference in references is that on the machine where it works, the name of the reference is "Microsoft Office 16.0 Object Library" while on the other it is "Microsoft Office 14.0 Object Library". The same is for "Microsoft Access 14.0/16.0 Object Library" and "Microsoft Office 14.0/16.0 Access Database engine Object Library"

Can the difrence in reference versions be causing the problem?
Acke is offline   Reply With Quote
Old 09-22-2019, 01:51 AM   #13
arnelgp
error reading drive A:
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,568
Thanks: 68
Thanked 2,744 Times in 2,629 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Which image formats to use with ribbon buttons?

here is the fix
Attached Files
File Type: zip Ribbon GetImage Example.zip (96.4 KB, 7 views)
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
The Following User Says Thank You to arnelgp For This Useful Post:
Acke (09-23-2019)
Old 09-23-2019, 09:59 AM   #14
Acke
Newly Registered User
 
Join Date: Jul 2006
Posts: 105
Thanks: 90
Thanked 1 Time in 1 Post
Acke is on a distinguished road
Re: Which image formats to use with ribbon buttons?

It is working now. Thanks
Acke is offline   Reply With Quote
Old 09-23-2019, 10:30 AM   #15
arnelgp
error reading drive A:
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,568
Thanks: 68
Thanked 2,744 Times in 2,629 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Which image formats to use with ribbon buttons?

you're welcome!
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Missing Ribbon Buttons on report at Runtime AOsment Reports 6 01-14-2009 11:11 AM
VB Dir function - not working? Splinters Modules & VBA 7 01-08-2009 08:02 PM
i've got a little 'add image' problem too... wiklendt Forms 7 12-22-2008 12:11 AM
Fancy 3D Image Buttons MStCyr Sample Databases 2 07-11-2006 06:20 AM
Mousemove image change on buttons...... Anauz Forms 3 08-27-2002 09:29 AM




All times are GMT -8. The time now is 10:53 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World