Click to See Complete Forum and Search --> : Picturebox image transparency


vinnureddy
April 1st, 2009, 05:47 AM
Hi

Controls used : picturebox control,placed a bmp image on it thru image property of picturebox.Made picturebox back color to transparent.(I have taken an arrow image downloaded from net,it has white background)

When we place image on the picturebox control and run the application white background is visible. I doent need the white background it should be transparent.

did with this code also

Bitmap Logo = new Bitmap(this.pboxMain.Image);
Logo.MakeTransparent(Logo.GetPixel(1, 1));
this.pboxMain.Image = (Image)Logo;
pboxMain.Refresh();

but still not working....

help me...

advance thanks

tr00don
April 1st, 2009, 09:51 AM
Maybe this info can help:

I store transparent PNG images in an ImageList; but my understanding is, the transparent background is automatically converted to white as ImageList can only store bitmaps. So "transparent" = white for my images.

Then I programatically load images from ImageList to a Picture that sits on top of a Panel. The background is white unless I set the BackColor property of the Picture to white and Panel to Transparent, in which case the Picture background is transparent as expected.

vinnureddy
April 2nd, 2009, 01:33 AM
Hi,

That didnt solved my problem.

I have tried in other way.Took help from one of my friend knowing photoshop to make the image have only arrow.No whitebackground.that made my work.

Thanks
vinni

toraj58
April 4th, 2009, 07:03 AM
Bitmap Logo = new Bitmap(this.pboxMain.Image);
Logo.MakeTransparent(Logo.GetPixel(1, 1));
this.pboxMain.Image = (Image)Logo;


i have used such code before and mine worked.
i think yours did not work because the pixel at (1,1) is not purly white.
in ARGB mode pure with is: Color [A=0, R=0, G=0, B=0]
even if you had a value like this: Color [A=0, R=1, G=0, B=0] at pixel (1,1) it is not pure white and it is likly that MakeTransparent have only trasparented that pixel only which is not visible to you unless you ZOOM and enlarge image.

zkidkid
April 4th, 2009, 10:15 PM
A other way is design your image again.

Example in Yahoo Message, it has many emotions such as ( :) :)) :-? ... so on )

when you use such image, it'll transparent. And you can make your own image like that.