Transparent Color in an Icon

G

Guest

How can I find the transparent color in an Icon and convert it into a Color
type in VB.Net 2003?

I want to convert it into a bitmap with the same color transparent. I know
that I can convert it to a bitmap then read the color of the pixel at 0,0
then make that color transparent in the bitmap but this doesn't work on icons
that have other than the transparent color in the 0,0 pixel position.
 
H

Herfried K. Wagner [MVP]

Dennis said:
How can I find the transparent color in an Icon and convert it into a
Color
type in VB.Net 2003?

I want to convert it into a bitmap with the same color transparent. I
know
that I can convert it to a bitmap then read the color of the pixel at 0,0
then make that color transparent in the bitmap but this doesn't work on
icons
that have other than the transparent color in the 0,0 pixel position.

Did you already try 'ToBitmap'? This method will preserve transparency:

\\\
Dim i As Icon = ...
Dim b As Bitmap = i.ToBitmap()
///
 
G

Guest

Haven't tried that yet but will do so. When it's converted to the bitmap, is
there any way to find the transparency color from the bitmap?
 
B

bastawhiz

Well, bitmaps really can't have transparent colors... I would
personally use PNGs. And even then, Microsoft is notorious for making
it almost impossible to use ARGB in .Net.
 
G

Guest

So how does bitmap.MakeTransparent(color.red) work. Doesn't the bit map
display routines mask all pixel colors with Red backgroud mask that is Xor'd
or something like that to cancel out displaying all red colors in the bitmap.
I'm looking to find what that color is...there must be someway since the
bitmap certainly can have transparent areas.
 

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