A .NET Technology blog | .NET,C# Progamming,C# tutorials,WPF WCF|Software Engineer


C# ImageList Images - Poor Image Quality, Poor image resolution when using ImageList in C#

If you ever used ImageList for setting images for controls like Treeview, you might have noticed the deteriorated quality of the image when it is taken from the ImageList.The solution for this issue is to set the proper ColorDepth for the imageList.

If you ever used an ImageList for setting image icons to individual nodes of .Net controls like Treeview,List view etc, you might have noticed the deteriorated quality of the image when it is taken from the ImageList even if the size of the image not changed.That is, the quality of the image from the ImageList is not same as the quality before the image was added to ImageList.

First solution is to use the image directly without an ImageList. But, if you are forced to insert the image to an ImageList and use images from the ImageList for whatever reason,you might end up in images with reduced clarity/resolution.Normally .NET controls like TreeView demands an ImageList with enough images to set image icons to each node of the tree control.

The Innovators: How a Group of Inventors, Hackers, Geniuses and Geeks Created the Digital Revolution- A must Read

There can be various solutions for this problem.But the easiest is to change the ColorDepth property of the corresponding source ImagesList control you are using for your controls like Treeview and Listview .

Select the ImageList > Go To Properties Window > set the ColorDepth property of image from Property window to  Depth32Bit.

Otherwise,if your ImageList control is programatically added to the form then use the below code line to set the color depth.

imageList.ColorDepth = ColorDepth.Depth32Bit;

Color depth is the number of bits used to indicate the color of a single pixel in a bit-mapped image.There is no 64 bit color choice for 64 bit system.32 bit depth will work for 32 bit system and also for 64 bit system.

Also remember, re-sizing the image will definitely deteriorate the image quality.


Happy Coding!

Add comment

  Country flag

  • Comment
  • Preview