imagelist & alphablending

B

Benoist Demeure

hi,

I work on WinXP with framework 1.1 ( using c# ).

I try to display a png image ( with transparency an alpha-blending ) in a
picturebox using an imagelist.

If i put the image directly in the picturebox, it's work fine.
But if i take the image from the imagelist, the alpha-blending seem to be
lost (picturebox.Image = imagelist.Images[0]).

somebody have information about this ?
 
B

Bob Powell [MVP]

An imagelist is a single bitmap onto which the component images are copied
when they're added. The alpha component is not maintained in the addition
process so unless the image is on a colour keyed background and the
imagelist.TransparentColor correctly set, the images will be opaque.

This is intended behaviour and ImageLists are not suitable for images having
per-pixel alpha values such as that available in PNG.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Image transition effects, automatic persistent configuration and
design time mouse operations all in April's issue of Well Formed
http://www.bobpowell.net/wellformed.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://royo.is-a-geek.com/siteFeeder/GetFeed.aspx?FeedId=41
 
H

Herfried K. Wagner [MVP]

* "Benoist Demeure said:
I work on WinXP with framework 1.1 ( using c# ).

I try to display a png image ( with transparency an alpha-blending ) in a
picturebox using an imagelist.

If i put the image directly in the picturebox, it's work fine.
But if i take the image from the imagelist, the alpha-blending seem to be
lost (picturebox.Image = imagelist.Images[0]).

That's a bug:

<URL:http://groups.google.de/groups?selm=uYT#[email protected]>

Workaround:

<URL:http://groups.google.de/groups?selm=erg9OcdJCHA.2548@tkmsftngp08>
 
B

Bob Powell [MVP]

Well, you lives and you learns...

--
Bob Powell [MVP]
Visual C#, System.Drawing

Image transition effects, automatic persistent configuration and
design time mouse operations all in April's issue of Well Formed
http://www.bobpowell.net/wellformed.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://royo.is-a-geek.com/siteFeeder/GetFeed.aspx?FeedId=41





Herfried K. Wagner said:
* "Benoist Demeure said:
I work on WinXP with framework 1.1 ( using c# ).

I try to display a png image ( with transparency an alpha-blending ) in a
picturebox using an imagelist.

If i put the image directly in the picturebox, it's work fine.
But if i take the image from the imagelist, the alpha-blending seem to be
lost (picturebox.Image = imagelist.Images[0]).

That's a bug:

<URL:http://groups.google.de/groups?selm=uYT#[email protected]
hx.gbl>

Workaround:

<URL:http://groups.google.de/groups?selm=erg9OcdJCHA.2548@tkmsftngp08>
 

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