简体   繁体   English

Window中的Icon属性会使Windows XP SP2中的应用程序崩溃

[英]The Icon property in the Window is crashing the application in Windows XP SP2

Suppose I have this: 假设我有这个:

<Window stuff Icon="Resources\\myicon.ico">

If I run the program on Windows 7, it's fine. 如果我在Windows 7上运行该程序,那很好。 If I run it on Windows XP SP2, it crashes. 如果我在Windows XP SP2上运行它,它会崩溃。 Removing the Icon property, it works fine on Windows XP, but then it doesn't have my myicon on the Windows 7 taskbar or on the Window. 删除Icon属性,它在Windows XP上运行正常,但它在Windows 7任务栏或Window上没有myicon。

Also, setting the application icon on the VS project menu doesn't work for W7, but works for XP. 此外,在VS项目菜单上设置应用程序图标不适用于W7,但适用于XP。 In summary: 综上所述:

<Icon> = broken XP, ok W7 <Icon> =破碎的XP,确定W7
No <Icon> = ok XP, ugly W7 没有<Icon> =好的XP,丑陋的W7
VS project icon option = doesn't work for W7, ok XP VS项目图标选项=不适用于W7,ok XP

For the record, I created icons for 16x16, 22x22, etc up till 256x256 for 32, 24 and 8 bits. 为了记录,我创建了16x16,22x22等图标,直到256x256为32,24和8位。 I also used IcoFX auto option of creating the .ico image for Windows XP. 我还使用IcoFX自动选项为Windows XP创建.ico映像。

Is there a way around this? 有没有解决的办法? Or do I have to choose between an ugly Windows 7(and Vista?) App or no Windows XP app? 或者我必须在丑陋的Windows 7(和Vista?)应用程序或没有Windows XP应用程序之间进行选择?

XP does not support 256x256 icons. XP不支持256x256图标。 Remove the 256 icon for XP. 删除XP的256图标。

It has nothing to do with the resolution, but with the format: Windows XP can't handle PNG compressed icons in an ICO file. 它与分辨率无关,但格式如下:Windows XP无法处理ICO文件中的PNG压缩图标。 Normally only the bigger reolutions are compressed, mostly 256x256. 通常只有较大的分辨率被压缩,大多数是256x256。
I used http://iconverticons.com/ to create ICO files and they also compress the 128x128 images using PNG. 我使用http://iconverticons.com/创建ICO文件,他们还使用PNG压缩128x128图像。

To solve this, open your ICO file in Visual Studio and delete all versions of the icon in PNG format. 要解决此问题,请在Visual Studio中打开ICO文件,并以PNG格式删除该图标的所有版本。 Alternatively you can convert the PNG icons to BMP format with icoFx. 或者,您可以使用icoFx将PNG图标转换为BMP格式。 Just disable compression in the options dialog and save your icon to a new file. 只需在选项对话框中禁用压缩,然后将图标保存到新文件即可。
You can download IcoFx latest free version here: http://www.chip.de/downloads/IcoFX-letzte-Freeware-Version_28266149.html 你可以在这里下载IcoFx最新的免费版本: http//www.chip.de/downloads/IcoFX-letzte-Freeware-Version_28266149.html

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

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