Link to home
Start Free TrialLog in
Avatar of HATCHET
HATCHET

asked on

(50 pts) Make Image Transparent

I'm creating an ActiveX control that will display pictures and make them transparent by specifying the transparent color.  This is similar to .GIF's where you specify the transparent color and it's thereafter transparent.

Is there way to set the transparent color of an image so that the image is transparent?  For example, if I put a BITMAP (.BMP) image with a black background into a PictureBox control... is there a way to set the transparent color of the picturebox to 0 so that the black background now is transparent and it is thereafter possible to see objects that are under the PictureBox in the areas that were black?

The way I'd like to use this is in an ActiveX control, set the BackStyle property of the UserControl of the ActiveX to Transparent, then set the transparent color of the UserControl to 0 so that the picture is the only thing that is visible.  Or perhaps put a PictureBox control on the UserControl of the ActiveX... set the UserControl to Transparent and them make the transparent color of the PictureBox 0 so it's transparent.

Maybe I'm barking up the wrong tree as far as how to go about this, these are just ideas of how to make a picture transparent.  Can anyone help me with this one?

Thanks,

HATCHET
Avatar of HATCHET
HATCHET

ASKER

Edited text of question.
I dont think you can make bmp's transapent.....
Avatar of HATCHET

ASKER

crazyman,

I'm looking to make the transparency on the PictureBox or UserControl, not the actual picture... thereby making the transparency color of the control transparent for it's Picture no mater what picture it contains... .GIF, .BMP, .JPG, etc.

I know it can be done because I have an ActiveX control that does it... I'd like to encourperate that into something I'm doing with out having to use his control as a dependency.

I also know that there is a little known or used transparency bit in Bitmap files.  I don't know much more about it, or transparency in general so that's why I'm asking this question.

HATCHET
I have a project that may be some use its too much to paste ,have you got an email i can send it to you.
I dont know if this helps but maybe you could modify it
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=3664
Avatar of HATCHET

ASKER

I'll check it out.  Thanks.

HATCHET
Avatar of HATCHET

ASKER

crazyman,

I did get that sample of yours to work to do what I need done.  I substituted the form for the UserControl of the ActiveX and it works perfectly.  However, my question of how to make a PictureBox picture transparent by making a color transparent hasn't been answered.  I'm gunna mess around with this sample and see if I can get the principles used in it to work with a single control.

If someone can answer how to do the aforementioned, I'll give you and that person points.  If no one else has any ideas about this, I'll accept your answer because I'm getting done what needs to be done for now.

Thanks again for the sample.

HATCHET
ASKER CERTIFIED SOLUTION
Avatar of tommy_boy
tommy_boy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
And this should have been 100 points