ImageList issues...

S

stumorgan

I'm trying to make a configuration menu similar to the one in the
Firefox options screen, with an icon-based toolbar at the top. I'm
using the ToolBar object which gets the icons from an ImageList.
However, the PNG files that I am putting in the ImageList look all
crappy compared to the originals. If I bring the same PNG file into a
PictureBox it looks perfect, but in the ImageList it has a gross blue
border and looks awful... Is there any way to fix this? I put it up
to 32-bit coloring so it's not that... Any ideas would be well
appreciated.

Thanks.
 
D

Dave Sexton

Hi,

Make sure that each .png image is stored as the actual size that you want them
to appear when they are on the button so that they don't have to be
automatically resized by the framework.

I'm not sure where the "blue border" is coming from, however. You might want
to try saving them as bitmaps instead.
 
B

Bob Powell [MVP]

The blue border is probably because the framework is resizing and
interpolating the pixels at the key-colour boundaries. Try using a white or
very light key colour.

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

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

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

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
D

Dave Sexton

Hi Bob,

Good point Bob - Thanks.

But, PNG supports gradient transparency so I suspect that the OP isn't keying
it at all. In that case the only option is to clean up the image in an editor
so that a single key color can be used.

--
Dave Sexton

Bob Powell said:
The blue border is probably because the framework is resizing and
interpolating the pixels at the key-colour boundaries. Try using a white or
very light key colour.

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

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

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

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
B

Bob Powell [MVP]

Hmm, what's the betting the background is transparent blue or transparent
black?

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

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

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

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
D

Dave Sexton

Hi Bob,

A bet for fun? I'm all in :)

Seriously, though, in my experience those artifacts show up when you use
differing levels of transparency across several colors, common along smoothed
edges of curves. If you clean up the image like you would a GIF then the
artifacts no longer appear, but it results in a loss of "smoothness". I'm not
sure that the back color matters at all.
 

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