472,117 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,117 software developers and data experts.

ImageList: Is this a bug...?

....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

Nov 20 '05 #1
16 2155
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" <ro******@hotmail.com> wrote in message
news:uF**************@TK2MSFTNGP10.phx.gbl...
...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

Nov 20 '05 #2
* "Roger" <ro******@hotmail.com> scripsit:
...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>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb

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>


If I had been so clever to ask google first, it would have saved me about 5
hours.... ;-((
--
Armin

Nov 20 '05 #4
* "Armin Zingler" <az*******@freenet.de> scripsit:
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>


If I had been so clever to ask google first, it would have saved me about 5
hours.... ;-((


Google is your friend!

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #5
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
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bv************@ID-208219.news.uni-berlin.de...
* "Roger" <ro******@hotmail.com> scripsit:
...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>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #6
* "Roger" <ro******@hotmail.com> scripsit:
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?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #7
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.... :-)
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bv************@ID-208219.news.uni-berlin.de...
* "Roger" <ro******@hotmail.com> scripsit:
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?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #8
* "Roger" <ro******@hotmail.com> scripsit:
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.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #9
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.GetExecutingAssemb ly.GetManifestResourceStre
am("testIcons.users128.ico")).)
ImageList1.ImageSize = New System.Drawing.Size(128, 128)

Button1.ImageList = ImageList1
Button1.ImageIndex = 0
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:Or*************@tk2msftngp13.phx.gbl...
* "Roger" <ro******@hotmail.com> scripsit:
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.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #10
* "Roger" <ro******@hotmail.com> scripsit:
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")?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #11
I used the image "users.png" included in the /bin folder of my original
post: http://langedal.com/testicons.zip

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:up*************@tk2msftngp13.phx.gbl...
* "Roger" <ro******@hotmail.com> scripsit:
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")?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #12
* "Roger" <ro******@hotmail.com> scripsit:
I used the image "users.png" included in the /bin folder of my original
post: http://langedal.com/testicons.zip


Ah, that's an image in PNG format with an alpha channel. Depending on
which program you used to convert it to an icon, the alpha channel still
exists in the icon.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #13
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....

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:et*************@tk2msftngp13.phx.gbl...
* "Roger" <ro******@hotmail.com> scripsit:
I used the image "users.png" included in the /bin folder of my original
post: http://langedal.com/testicons.zip


Ah, that's an image in PNG format with an alpha channel. Depending on
which program you used to convert it to an icon, the alpha channel still
exists in the icon.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #14
* "Roger" <ro******@hotmail.com> scripsit:
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.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #15
Herfried,

I've uploaded the modified project, and both users.png and users128.ico is
located in the "images" folder.
http://langedal.com/testicons.zip
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OJ*************@tk2msftngp13.phx.gbl...
* "Roger" <ro******@hotmail.com> scripsit:
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.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #16
Roger,

* "Roger" <ro******@hotmail.com> scripsit:
I've uploaded the modified project, and both users.png and users128.ico is
located in the "images" folder.
http://langedal.com/testicons.zip


Thank you. I'll reply if I find out something...

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #17

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Bob C. | last post: by
7 posts views Thread by Andrew Christiansen | last post: by
4 posts views Thread by Just Me | last post: by
6 posts views Thread by henrycortezwu | last post: by
2 posts views Thread by senfo | last post: by
2 posts views Thread by =?Utf-8?B?S2VuTg==?= | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.