ImageList issue

V

Vittorio Pavesi

Hello,
I'm experiencing error displaying PNG images with transparent background
using ImageList; the picture is displayed in a wrong way.
Picturebox doesn't seem to be affected by this problem.
I also found some discussion on google about problem with imagelist and
images with alpha colour but I don't know what alpha colour is...
Any help ?


Vittorio Pavesi
 
H

Herfried K. Wagner [MVP]

Vittorio Pavesi said:
I'm experiencing error displaying PNG images with transparent background
using ImageList; the picture is displayed in a wrong way.
Picturebox doesn't seem to be affected by this problem.
I also found some discussion on google about problem with imagelist and
images with alpha colour but I don't know what alpha colour is...

An alpha channel adds additional transparency information to each pixel,
typically with values 0 to 255. You can use Adobe Photoshop to create PNGs
with an alpha channel, for example. Note that the imagelist component
currently cannot deal with an alpha channel.
 
V

Vittorio Pavesi

Herfried said:
An alpha channel adds additional transparency information to each pixel,
typically with values 0 to 255. You can use Adobe Photoshop to create
PNGs with an alpha channel, for example. Note that the imagelist
component currently cannot deal with an alpha channel.

Really thanks

Vittorio Pavesi
 
G

Guest

Can you convert the PNG images to a bitmap then add the transparency color
and add it to the Image List:

dim v_Img24 as ImageList = new ImageList

bm = (convert your PNG image to a bitmap)
v_Img24.ImageSize = New Size(24, 24)
v_Img24.TransparentColor = bm.GetPixel(0, 0)
format = bm.PixelFormat
v_Img24.Images.Add(bm)
bm.Dispose()
 
V

Vittorio Pavesi

Dennis said:
Can you convert the PNG images to a bitmap then add the transparency color
and add it to the Image List:

dim v_Img24 as ImageList = new ImageList

bm = (convert your PNG image to a bitmap)
v_Img24.ImageSize = New Size(24, 24)
v_Img24.TransparentColor = bm.GetPixel(0, 0)
format = bm.PixelFormat
v_Img24.Images.Add(bm)
bm.Dispose()
Do the statement bm.GetPixel(0, 0) define white or transparent ?
Thanks

Vittorio Pavesi
 
G

Guest

It is only the pixel in the upper left hand corner of the bitmap. I know
that is the color I want to be transparent be it white, black, red, or
whatever. If you don't know any pixel locations whose color is what you want
to be transparent, then this won't work.
 

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