Question

I'm attempting to display a "LargeIcon" view in a listview control, however the images I specify are blurry. This is what I have so far: alt text http://img220.imageshack.us/img220/1005/blurryiconsql3.jpg

The .png files are 48x48 and that's what I have it set to display at in the ImageList properties. There's one thing that I've noticed (which is probably the cause) but I don't know how to change it. Inside the "Images Collection Editor" where you choose what images you want for the ImageList control, it looks like it's setting the wrong size for each image. alt text http://img83.imageshack.us/img83/5218/imagepropertiesmf9.jpg

As you can see the "PhysicalDimension" and the "Size" is set to 16x16 and not abled to be manipulated. Does anyone have any ideas? Many thanks!

Was it helpful?

Solution

When adding a .PNG Icon format size the editor tends to pick the first entry size in that file, so it picks up the 16x16 entry and it's stretching that out. That's why you see the 16x16 in the properties there. As suggested, the support for PNG is poor, I'm often found myself rolling over to another format as well to avoid this.

You can open the file in Paint.Net if you need a free editor or something more fully featured like Photoshop or Fireworks and extract the exact size you want.

OTHER TIPS

Be sure to set ImageList.ImageSize to 48 x 48 too.

I'm not sure if its the problem in this specific case, but Microsoft support for the PNG format is generally poor. Try adding the images in .bmp format and they should display fine.

Be sure to set the ImageList size to 48x48 px BEFORE you add the images.

If the ImageList is set to 32x32 and you add a 48x48 image, the icon is resized to 32x32. When you change the ImageList to 48x48 afterwards, the image is just resized again, thus losing quality and going blurry.

Also, Paint.NET (or Photoshop) can't open .ico files.

Visual Studio/.NET can handle 32-bit PNG images fine, the built-in image editor in VS is a bit lack-lustre though.

Check also the ColorDepth setting on your ImageList. I had a similar issue with a TreeView control, but after reading the previous posting regarding the size I found this setting, played around with it a bit and found that it greatly affects the way images from an ImageList are rendered. The higher the depth the better the quality.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top