ImageList issue

  • Thread starter Thread starter Vittorio Pavesi
  • Start date Start date
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
 
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.
 
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
 
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()
 
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
 
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.
 
Back
Top