如何让Windows从.ico资源中选择正确的图标大小 [英] How to get Windows to choose the right icon size from an .ico resource

查看:515
本文介绍了如何让Windows从.ico资源中选择正确的图标大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio中制作了一个图标,其中有几种尺寸,包括20x20和16x16,以考虑不同的DPI设置。



问题是当显示小窗口图标和Systray图标时,Windows正在选择20x20图标并将其可怕地缩小到16x16,而不是使用提供的16x16图标。为什么它没有使用提供的正确尺寸以及如何解决这个问题?

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?

推荐答案

我想说,这样做是错误的想法。为什么需要ICO文件?这是在同一个图标对象中打包几个版本的图标的方法,因此操作系统可以选择正确的,取决于视图,目前,其中之一:16×16,32×32,48×48,和256×256。操作系统知道该怎么做。也就是说,应该为窗口图标,应用程序图标设置图标......我真的不知道还有什么。对于其他一切,请使用某种位图或矢量图形图像。



-SA
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


无意中使用LoadIcon()尝试加载大尺寸图标。切换到LoadIconMetric()
Was accidently using LoadIcon() which tries to load the big sized icon. Switched to LoadIconMetric()


这篇关于如何让Windows从.ico资源中选择正确的图标大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆