Click here to Skip to main content
15,881,787 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I've made an icon in Visual Studio that has several sizes in it including 20x20 and 16x16, to account for different DPI settings.

The problem is that when displaying the small window icon, and the Systray icon, Windows is selecting the 20x20 icon and scaling it horribly down to 16x16, instead of using the 16x16 icon provided. Why isn't it using the correct size provided and how can I work around this?
Posted
Comments
Dhiraj Pallin 24-Apr-13 20:23pm    
Hmm actually. It seems that LoadIcon() is an obsolete function and I should be using LoadIconMetric() or LoadImage(). That could be the problem.

I would say, doing so is a wrong idea. Why ICO files are needed at all? This is the way to pack few versions of the icon in the same icon object, so OS could pick up the right one, depending on the view, presently, one of the: 16×16, 32×32, 48×48, and 256×256. OS knows what to do. That said, the icon should be set for the window icon, the application icon and… I don't really know what else. For everything else, use some kind of bitmap or vector graphics images.

—SA
 
Share this answer
 
Was accidently using LoadIcon() which tries to load the big sized icon. Switched to LoadIconMetric()
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 5-May-13 0:21am    
Not an answer.
—SA
Uwe_Sieber 10-Oct-21 10:05am    
After hours of trying to get a high quality stock icon at 144 dpi LoadIconMetric() now made my day. LoadIcon and even LoadImage just kept delivering a 32x32 icon.
Thanks after 8 years :-)

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