Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET3.5 icon
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 5-Sep-11 8:07am
Comments
Mehdi Gholam at 5-Sep-11 13:13pm
   
How are you loading your icon files at runtime?

1 solution

Rate this: bad
good
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.
 
—SA
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 295
1 DamithSL 265
2 CPallini 235
3 Maciej Los 190
4 George Jonsson 170
0 OriginalGriff 5,415
1 DamithSL 4,422
2 Maciej Los 3,820
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,911


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 5 Sep 2011
Copyright © CodeProject, 1999-2014
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