Help: ImageList.TransparentColor

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

I have a ImageList associated with the treeview on one of my forms. The
treeview itself is contained within a Panel.

I set the TransparentColor property of my ImageList to
System.Drawing.Color.Lime in order to mask (have the color treated as
transparent) the Lime color

///
Me.imgItems.TransparentColor = Color.LimeGreen
\\\

However this doesn't appear to work. The specific green color is still
visible!

I would appreciate your comments on this.

TIA.
 
Sarika said:
I set the TransparentColor property of my ImageList to
System.Drawing.Color.Lime in order to mask (have the color treated as
transparent) the Lime color

///
Me.imgItems.TransparentColor = Color.LimeGreen
\\\

However this doesn't appear to work. The specific green color is still
visible!

Maybe the color in the images is not exactly 'Color.LimeGreen'. You may
want to set 'TransparentColor' to a color generated using 'Color.FromArgb'.
 
Thanks for the suggestion Herfried. I tried that, infact I tried all the
colors that I thought looked like my green. I also tried

///
'The color code I got from my original VB6.0 program.
'I also tried removing the trailing ampersand
Me.imgItems.TransparentColor = ColorTranslator.FromOle(&HFFO&)
\\\

But nothing works! :(.......Just for fun I tried masking black and it
worked. So I am completely puzzled as to why the green isn't working.

Thanks.
 
Another thing I tried was

Created a test project w/ 2 forms. One form had a treeview and another
picturebox. I associated an imagelist with each of the controls and loaded
similar images into both of them. I assigned the same mask color Color.Lime
to both.

The color was masked for the picturebox, but not for the treeview. So I am
wondering if it is something other than the color that is causing this
problem.

TIA
 
///
'Form containing the controls which needed the masking
Me.TransparencyKey = Color.Lime
\\\

This worked, however the image on certain nodes looks weird, like it might
show some characters or something else. Also some nodes look perfect with
just the way the image should be.

So I would say this is a temporary solution.
 
Back
Top