Set application icon and window icon to Windows 7 friendly icon

别说谁变了你拦得住时间么 提交于 2019-12-09 06:57:05

问题


I've created a WPF project in Visual Studio 2010 using .net 4.0

I've created an icon with many different sizes and formats right from 16x16 4 bit BMP up to 256x256 24 bit BMP. I set it as the program's icon in the property pages for the application, and as the window's icon in the icon propety on a WPF Window.

This works to a point. The icon is displayed in all the expected location, however, it seems invariably to use one of th lower resolution images. In the task bar it apperas to be using a 16x16 image. In the folder if you view the exe file with it set to extra large icons it appears as a tiny image with lots of white space arround it, rather than choosing the large icon. Even if I set it up with a 256x256 icon as the only icon, it seems to scale it down, and then put it in the middle with lots of white space around it.


回答1:


See here for some ideas. Also be sure to clean the icon cache (thumbs.db?) to see the updated icon in explorer.

Edit: IcoFx also behaved quite nicely in my tests.




回答2:


You must set the image dpi to 96. Be Aware of DPI with Image PNGs in WPF - Images Scale Weird or are Blurry



来源:https://stackoverflow.com/questions/3787433/set-application-icon-and-window-icon-to-windows-7-friendly-icon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!