Click here to Skip to main content
15,880,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Colleagues,

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
Comments
Mehdi Gholam 5-Sep-11 13:13pm    
How are you loading your icon files at runtime?

1 solution

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.

—SA
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900