ImageList: Is this a bug...?

  • Thread starter Thread starter Roger
  • Start date Start date
R

Roger

....or am I missing something?

Setup:

- I've created an empty Winforms project, and added two buttons A and B.
- Button A's Image property is set to point to a imagefile calles
"users.png"
- Added an imagelist and added the SAME image to this list, setting the
properties (size etc.) exactly the same as for A's Image property.
- Set button B's ImageList property to the new imagelist created, and it's
imageindex to 0.

The picture now shows on both buttons, but while Button A's image looks
great, Button B's image looks awful, with a blue border around
it....remember: It is the exact same picture, size, etc....

I did another post earlier, but after trying to tweak every possible setting
myself, and after extensive help from Armin Zingler, we have still not found
a reason for this behaviour. This may possibly be a problem affecting a lot
of users, so if anyone has suggestions on why this occurs, please let me
know... And if this is not a bug, there should be someone out there that
knows how to fix this....I hope... :-)

I've provided a link to my testproject, the original .png image is in the
/bin folder.

http://langedal.com/testicons.zip

Getting increasingly frustrated.... ;-)

Roger
 
I tried setting the Imagelist's Colordepth to 24-bits instead of 8bit, and
nothing. So maybe it's a bug... The same happens on the Toolbar.
By the way, that is a great image! How/where did you get them? created them
yourself?

Andre Nogueira
 
* "Roger said:
...or am I missing something?

Setup:

- I've created an empty Winforms project, and added two buttons A and B.
- Button A's Image property is set to point to a imagefile calles
"users.png"
- Added an imagelist and added the SAME image to this list, setting the
properties (size etc.) exactly the same as for A's Image property.
- Set button B's ImageList property to the new imagelist created, and it's
imageindex to 0.

The picture now shows on both buttons, but while Button A's image looks
great, Button B's image looks awful, with a blue border around
it....remember: It is the exact same picture, size, etc....

That's an issue with the ImageList control. The imagelist will support
bitmaps only when used at design time. Nevertheless, I didn't get it
work with adding the images at runtime (the blue changes to black).

There were some other threads on this issue, maybe you will find
something useful there:

<http://www.google.com/groups?q=dotnet+imagelist+transparency+png>
 
Thanks guys for excellent help :-)

As a workaround I've ended up doctoring the png's into bmp's with a
background color matching my app, to fake transparency.... :-D Annoying
extra-work, but it works..... Hope MS knows about this issue and addresses
it...

Thanks again,
Roger
 
* "Roger said:
As a workaround I've ended up doctoring the png's into bmp's with a
background color matching my app, to fake transparency.... :-D Annoying
extra-work, but it works..... Hope MS knows about this issue and addresses
it...

But this won't allow an alpha chanel, or am I missing something?
 
True :-)

It seemed at first glance to work, but no it is far from what I
wanted....but I haven't found a way to "hack" this from the links you
posted. Maybe I'm giving up way to easily.... :-)
 
* "Roger said:
It seemed at first glance to work, but no it is far from what I
wanted....but I haven't found a way to "hack" this from the links you
posted. Maybe I'm giving up way to easily.... :-)

I had a look at the links I posted and I see that there is no good
solution to the problem available.
 
If I convert my .png to an .ico file, and add it to my project as an
embedded resource it seems to handle the transparency problem moe
gracefully, but still the edges seems jagged and rough...

Using this code:

ImageList1.Images.Add(New
Icon(System.Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStre
am("testIcons.users128.ico")).)
ImageList1.ImageSize = New System.Drawing.Size(128, 128)

Button1.ImageList = ImageList1
Button1.ImageIndex = 0
 
* "Roger said:
If I convert my .png to an .ico file, and add it to my project as an
embedded resource it seems to handle the transparency problem moe
gracefully, but still the edges seems jagged and rough...

Did you use an icon with alpha channel ("Windows XP Icons")?
 
I did use Photoshop with a plugin for handling .ico files....

If I use an external viewer after converting to .ico it looks good to me.
Only after being chewed on by the imagelist, the picture looks jagged and
rough again when placed on a button....
 
* "Roger said:
I did use Photoshop with a plugin for handling .ico files....

If I use an external viewer after converting to .ico it looks good to me.
Only after being chewed on by the imagelist, the picture looks jagged and
rough again when placed on a button....

Can you upload the icon file too? Maybe I will find some time to play
around with it.
 
Back
Top