By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,790 Members | 1,407 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,790 IT Pros & Developers. It's quick & easy.

Is there a "Transparent Color" for images?

100+
P: 675
I want to put my own icon on a form. For discussion purposes, lets say that I want a very large "option button" from my collection of personal images.

Of course, there are 2 images, imgOptButtTrue and imgOptButtFalse. I would like these to go on any form, any color.

As images are rectangular in shape, I need to fill the area outside the circle with some color that allows the background color show through. Either that, or I need to be able to change these same pixels to a certain color on form load.

This is possible for cursors developed in Visual Basic, which I do not own. Can it be done for Access. Attempts to create an image by changing .cur to some other extension hasn't worked. Assigning an image with the extension .cur accepts the assignment, but does not display the image.

OldBirdman
Dec 28 '07 #1
Share this Question
Share on Google+
21 Replies


Minion
Expert 100+
P: 108
When doing some searching I found this thread from some time ago on the board. (http://www.thescripts.com/forum/thread441620.html) It mentions needing to do some other things with transparent images, but it does link to a site with a DB that was built to convert images to EMF files that seem to work.

Hope this helps.

- Minion -
Dec 28 '07 #2

100+
P: 675
I followed the 7 step program in the link suggested. My image has a white background, so it should work. However, setting back style to transparent did not change the white to transparent. I have a black-and-white, rectangular, image on my form.

I don't have anything to manipulate images other than Paint, and therefore the pixel color for white may not be the same white as needed for transparency.

Do I need another program for generating my own icons/images, or is there a way in Paint to assure the correct white?

OldBirdman
Dec 28 '07 #3

jaxjagfan
Expert 100+
P: 254
The background color is the color of the image control background (the container the image is in) - not the image itself. If you want to make the background of the image itself tranparent then try Paint Shop Pro (I use Photoshop and Fireworks but both are a bit more expensive than PSP.) The image would need to be saved in a GIF or PNG format - JPG and BMP will not save the transparency info to the image file.
Dec 28 '07 #4

100+
P: 675
So the answer is NO! It cannot be done within the Microsoft environment. I need expensive programs to impliment.

Thanks to both of you.

OldBirdman
Dec 28 '07 #5

jaxjagfan
Expert 100+
P: 254
So the answer is NO! It cannot be done within the Microsoft environment. I need expensive programs to impliment.

Thanks to both of you.

OldBirdman
No expensive tools required. Go to zdnet.com or download.com (and others). The are free and trial versions of software that you can use to create transparent images.

It takes a lot of work to get an Access form to look Professional and not look like ACCESS. You can spend more time on the user interface than coding its functionality if you get picky. Get your application to function first then go back and do the "pretty" stuff.
Dec 28 '07 #6

100+
P: 675
I am trying to sell my ideas to a local retail chain, and "Pretty" is more important than Access practable. At this time I need pretty.

OldBirdman
Dec 28 '07 #7

100+
P: 675
I have spent an entire day (12/29/07) investigating programs that claim to give transparency. Maybe they do in the Windows/Desktop environment, but not in Access. I want transparency in Access.

For purposes of this discussion, I'm going to, for the moment, work in the Microsoft environment. Access, Paint, etc.

I want to create my own pictures for command buttons. ALL Buttons in Access are gray (grey in Anglo-Saxon???). But what color gray? I don't know how to transfer a 24 bit number in Access into a color in Paint. The default "Gray" is not the same in both programs, and the "Pick" ("Pik") tool does not allow me to go outside the image I am editing.

I downloaded 7 different paint programs. None allowed Pick outside the image being edited. Every shade of gray I try is too pink. I used their transparent color, but Access doesn't recognize this.

Is there any way to develop a "Library" of icons for either buttons, or on the form, that allows the background color to show. i.e. I want a black "Not", a circle with a diagonal line thru it, on any form, any color. Possible?

OldBirdman
P.S. "Get your application to function first then go back and do the 'pretty' stuff". Who said my application doesn't function? Even if it doesn't, this question will come up when it does. I want all answers I will need, even if not presented to this forum in serial order.
Dec 30 '07 #8

FishVal
Expert 2.5K+
P: 2,653
Hi, OldBirdman.

Take a look at the attached Icon file created in open-source graphical editor GIMP 2.

Regards,
Fish
Attached Files
File Type: zip (No).zip (418 Bytes, 564 views)
Dec 30 '07 #9

100+
P: 675
The attached icon has a background color equal to (or close to) the default button color of MSAccess. For that, I agree.

If I try to use it as an image on the form, which is not gray, the gray background contrasts with the form color.

Let us say I want a Large, Purple Arrow pointing to the control (TextBox) that has the error. Let us also say that the form color was a user option, and so I don't know what it is. I do know where the control is, and so I can locate the image with .top = top.txtboxZZZ - 1440 * .3 and .left = left.txtboxZZZ - 1440 * .4 . But I do not want a purple arrow in a gray field, I want a purple arrow surrounded by the background color of the form (or detail section if you are going to nit pik).

Cursors created in visual basic cursor editor have a transparent color, and this transparency applies to all windows applications. So really my question is - Does MSAccess support any color as transparent so I can put my standard purple arrow on any form or button?

OldBirdman
Jan 4 '08 #10

jaxjagfan
Expert 100+
P: 254
The icon created by FishVal is transparent in an unbound object control. The default image control apparently will not work - i tried a few different image types. You may need to look into custom controls for this. I normally change forecolor or backcolor of the textbox or its label to highlight an error and disable navigation controls until error is resolved.
Jan 4 '08 #11

100+
P: 675
Thank you jaxjagfan:

So beyond knowing that I can do what I asked, and why I can't do what I asked, what next?

This is the question to the forum, and the answers so far presented do not solve the problem, only tell me that the problem is solvable. There is a huge difference between solved and solvable.

I want to create a "library" of icons to place on a form. These should have a transparent backcolor, so they will go anywhere on any form.

I know that this is possible, from previous posts, but I guess I am missing something. I cannot do this. Why?

OldBirdman
Jan 5 '08 #12

FishVal
Expert 2.5K+
P: 2,653
Hi, OldBirdman.

Access (particulary Image control) has problems with displaying transparent color. You may try to use pictures in vector format (.wmf or .cdr). That seems to work.
OLE unbound control seems to display transparent color properly but it couldn't be transparent itself. :(

Regards,
Fish
Jan 13 '08 #13

100+
P: 675
You guys(gals) are great! I get usable answers to over 50% of my posts. For that I am extremely grateful.

This question is not going to be one of my success stories. Using my "Purple Arrow" of #10, I can create this in "Paint" with any background whatever. Except transparent. OK, I have this icon in my library, but it only works in one program with one background color.

In simple steps, can I convert this .ico file to .wmf or .cdr, or some other extension that supports transparency.

Notice in post #5, I wanted to quit this thread and use "No" for the answer. But the thread continues. "Go to zdnet.com or download.com (and others)", which I did, and could not find anything that would convert my icons to icons with transparent backgrounds. Posts beyond this I have looked at, downloaded samples, etc. but I cannot get these answers to fit my question.

I am stymied. I have a 2 color "Purple Arrow on Gray Background" icon. I need a step by step instruction to convert the Gray to transparent, or I need to close this thread.

OldBirdman
Jan 18 '08 #14

FishVal
Expert 2.5K+
P: 2,653
Dear sir.

First and for most lets separate cutlet from flies.

Cutlet.
One can easily create an image with transparent background in a format supporting transparent color, btw the image I've attached to the thread previously has a transparent background.

Flies.
Access.Image control doesn't display transparent color properly and Access.ObjectFrame on the other hand displays transparent color properly but the control itself couldn't be transparent - bad luck.

The easiest workaround I see here is to use pictures in vector format: CDR (CorelDraw) or WMF/EMF (Windows Metafile). Access.Image control displays these formats with transparent background.

I'm attaching a simple WMF with purple arrow created in trial version of Companion metafile editor

Kindest regards,
Fish
Attached Files
File Type: zip parrow.zip (257 Bytes, 403 views)
Jan 18 '08 #15

100+
P: 675
I tried your "Purple Arrow", and it does have a transparent background, and Access accepts it nicely in an image control.

I have downloaded the trial version of Companion metafile, and have been trying to create my own images. Can't do yet, but if I start with yours, I can do it.

Too bad wmf files won't also work on command buttons. Maybe I'll write my own button control and then I could have colored buttons, not gray. Shapes other than rectangular also. Might be fun.

Anyway, thank you for all your help.

OldBirdman
Jan 18 '08 #16

FishVal
Expert 2.5K+
P: 2,653
You may use MSForms.CommandButton.
See the attached file.

P.S. The buttons in the attached file were edited in Excel and then copypasted to Access form.
Attached Files
File Type: zip MSForms.CommandButton.zip (12.1 KB, 467 views)
Jan 19 '08 #17

P: 1
Hi,
Just an idea, I find that rather than a transparent background cxreating an image file with an exactly matched bacground works 100%. Just find the RGB code of the Access background and with the graphic editor replace the image background with it. Gimp should be able to do this (I personally use Photopaint.
Good luck
Jan 20 '08 #18

100+
P: 675
FishVal - I looked at your colored buttons, but I cannot do that. I purchased this computer with Office 2000-Professional pre-installed. I do not have a disk, and Excel says I need to insert the disk to get the feature. Tried my Office 98 disk, but didn't work. Very nice though.

Whenever I try to go beyond basic, native, Access, I seem to get into trouble. The libraries are not available, and I must re-establish them using References ... As I don't know how to figure out which ones I need, I get stymied. I have enough trouble just keeping the toolbars correct from session to session, or the form size to be consistant.

So for now, I'll just use gray buttons. The gif files don't work on buttons, so that idea is gone.

1961(Roman) - Post #1, paragraph 2 clearly states that I am not prepared to hold to a single color for each and every form I design/develop. Beyond that, I tried to build my own collection of button images. I have not located a picture edit program that will tell me the default color of Access buttons. The basic gray is not as pink as the Paint default gray. I do not have a picture editor that allows a pik beyond the window where the edit is preformed.

OldBirdman
Jan 22 '08 #19

P: 1
I found this thread looking for the same information as OldBirdman.
I wished to use Office toolbar bitmaps (or any other bitmap) as an Access (2003 in this case) button image. These are 16x16pixel images.

Here is my solution:
If you don't already have the bitmap file:
Copy the image you want to the clipboard - I used the toolbar customise utility to capture the desired toolbar button image to clipboard.
Open Paint and paste the image into a new window. You might want to set the image attributes to 16x16 beforehand.
Save the bitmap using whatever folder and name you want.

Then:
I then used a program called IcoFX - freeware, to import the bitmap into a new icon 'document' in IcoFX. Make sure to set the icon size to 16x16 (if that's what you want).
Then using IcoFX, clear the unwanted background colour, The transparent background "colour" is indicated by a gray and white checkerboard pattern in the colours dialog of IcoFX. Bring the checkboard "colour" to the foreground brush, then paint using fill or pen to replace the unwanted colour.

Save the icon to file. Use the Image/Data Type menu to select "24bits True colors" as the icon data type. 24bits with alpha channel doesn't work in Access 2003.

Close the file in IcoFX.

Return to Access and go to the button properties - select the button picture property and browse to your new ico file. Select Icons (*.ico) as the file format in the "files of type" selection at the bottom of the file dialog. The new icon should load and display in the button face with no cruddy fringe colour. The button will probably resize to just fit the 16x16 image - just resize the button as needed after applying the icon image.

I haven't tried to do larger images, but the icon file format in XP, anyway, does support larger images within the same ico file. This might help for larger images.

No doubt any icon editor would be just as capable.
Good luck.
Mar 15 '08 #20

P: 13
The IcoFX method is very good. It should be noted that in Access 2003 when you embed a bitmap it doesn't store the transparency but converts it to the button's background. Instead store it as a linked bitmap. You still need to reload the form (which reloads the picture) when the color settings change to update the the transparency.
If you need to specify a relative path, set it in VBA on Form Load relative to Application.CurrentProject.Path.
Here's my code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.     Dim control As Variant, button As CommandButton
  3.     For Each control In Form.Controls
  4.         If TypeOf control Is CommandButton And control.Tag = "editlistbitmap" Then
  5.             Set button = control ' you don't need to cast it but this way I got method completion
  6.             button.PictureType = 1
  7.             button.Picture = Application.CurrentProject.Path & "\edit1.ico"
  8.         End If
  9.     Next
  10. End Sub
  11.  
Aug 24 '08 #21

P: 1
for me, this approach works:

1. open your image-file in the application "IrfanView"
2. save the file as ".ico" and choose the option "ICO: save transparent color" (wording approx., got only the german version)
3. now you can choose that file in access as image for a command including tranparency.
Jun 11 '10 #22

Post your reply

Sign in to post your reply or Sign up for a free account.