Click here to Skip to main content
13,089,246 members (65,500 online)
Rate this:
Please Sign up or sign in to vote.
See more:

As you know, the .ico files contain multiple images with different sizes and color depths. To display a 16x16 icon in my tree view, I found an .ico file which has the appropriate size image among other sizes. I’ve got an ImageList, with ImageSize set to 16x16. At design time, I’ve loaded the .ico into the ImageList. But the ImageList shows PhysicalDimension for this icon as 32x32 (PhysicalDimension is read-only). Looks like ImageList chose the wrong size.

As a workaround, I can extract the needed 16x16 image and save it as a separate file (may be in a different format). But, is there a way to make ImageList pick the right size from the .ico file?

Any suggestion, insight or reference is appreciated!

- Nick
Posted 5-Sep-11 7:07am
Mehdi Gholam 5-Sep-11 13:13pm
How are you loading your icon files at runtime?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The class System.Windows.Forms.ImageList is designed to be used with bitmaps, not icons. Where it is used (images for TreeView and the like), icons are not needed. If you really need icons, it means you don't need ImageList; use any container you prefer from the namespace System.Collections.Generic.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 5 Sep 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100