简体   繁体   English

Win7中的图标文件无效,字体缩放为125%

[英]Icon file invalid in Win7 only with fonts scaled to 125%

A customer has his fonts enlarged to 125% on Windows 7-64. 在Windows 7-64上,客户将其字体放大到125%。 This causes our app to crash with this error: 这会导致我们的应用程序因此错误而崩溃:

System.ArgumentException: Argument 'picture' must be a picture that can be used as a Icon. System.ArgumentException:参数'picture'必须是可用作Icon的图片。

To track down the problem, I loaded Visual Studio onto a VM running Win7-64 Pro, then opened my project. 为了追踪问题,我将Visual Studio加载到运行Win7-64 Pro的VM上,然后打开我的项目。 If the font is set to normal (100%), everything works fine, however if I change the Windows display font scaling to 125% and try to build the project, I get the same error message from the compiler! 如果字体设置为正常(100%),一切正常,但是如果我将Windows显示字体缩放到125%并尝试构建项目,我从编译器得到相同的错误消息! That's right, the Visual Studio resource editor tells me the icon file is not valid, but when I put the font scaling back to 100%, everything is OK. 没错,Visual Studio资源编辑器告诉我图标文件无效,但是当我将字体缩放回100%时,一切正常。

As far as I can tell, it is a valid .ico file. 据我所知,这是一个有效的.ico文件。 In VS, I can double-click on it (from the Resources tab of project properties) and it opens in the icon editor. 在VS中,我可以双击它(从项目属性的“资源”选项卡),然后在图标编辑器中打开它。
The following sizes are implemented: 实施以下规模:

  • 16x16,32 bit, BMP 16x16,32位,BMP
  • 24x24,32 bit, BMP 24x24,32位,BMP
  • 32x32,32 bit, BMP 32x32,32位,BMP
  • 48x48,32 bit, BMP 48x48,32位,BMP
  • 64x64,32 bit, BMP 64x64,32位,BMP
  • 96x96,32 bit, BMP 96x96,32位,BMP
  • 128x128,32 bit, BMP 128x128,32位,BMP
  • 192x192,32 bit, BMP 192x192,32位,BMP
  • 256x256,32 bit, BMP 256x256,32位,BMP
  • 300x300,32 bit, BMP 300x300,32位,BMP

Any ideas? 有任何想法吗?

Thanks! 谢谢!

40x40 is also needed. 40x40也是需要的。

While reading this post: Which icon sizes should my Windows application's icon include? 阅读本文时: 我的Windows应用程序的图标应包含哪些图标大小?

I noticed mention of 40x40 pixel image, which I'd never seen before, but 40 just happens to be 125% of 32, so I tried it. 我注意到提到了40x40像素的图像,这是我以前从未见过的,但40只恰好是32%的125%,所以我试了一下。

Although 40x40 isn't one of the normal sizes created by the icon-generator tools I've used, I was able to edit the icon file and manually add this size using the free trial of icofx (www.icofx.ro). 虽然40x40不是我使用的图标生成器工具创建的正常尺寸之一,但我能够编辑图标文件并使用icofx(www.icofx.ro)的免费试用版手动添加此尺寸。

Now our app runs on Win7 with 125% enlarged fonts. 现在我们的应用程序在Win7上运行,扩大了125%的字体。

-Hope that helps someone. - 希望帮助别人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM