C#参数'picture'必须是可以作为Icon的图片

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10333256/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 13:26:37  来源:igfitidea点击:

C# Argument 'picture' must be a picture that can be used as an Icon

c#winformsvisual-studio-2010icons

提问by L337BEAN

I am having trouble importing an icon into my application. I have a main form and I am trying to import to it a new icon via the Iconfield in Properties.

我在将图标导入我的应用程序时遇到问题。我有一个主要形式,我试图通过导入到一个新的图标Icon在现场Properties

The image is already in .icoformat: this is the link to the icon I'm trying to use.

图像已经.ico格式化:这是我尝试使用的图标的链接

Does anyone know why Microsoft Visual Studio would be displaying this error?

有谁知道为什么 Microsoft Visual Studio 会显示此错误?

Argument 'picture' must be a picture that can be used as an Icon

参数 'picture' 必须是可以用作 Icon 的图片

Any help would be great.

任何帮助都会很棒。

采纳答案by L337BEAN

After a second restart and then opening and re-saving the .ico myself in Gimp, then I was able to import it without any errors. Not too sure what caused this problem but it was just a freak error.

在第二次重新启动,然后自己在 Gimp 中打开并重新保存 .ico 之后,我就可以毫无错误地导入它了。不太确定是什么导致了这个问题,但这只是一个奇怪的错误。

回答by Wingman4l7

I had this error recently. Some recommendations:

我最近有这个错误。一些建议:

  • make sure the icon is square (16x16, 32x32)
  • try saving it to a PNG and using this free service for conversion : http://www.convertico.com/
  • 确保图标为方形(16x16、32x32)
  • 尝试将其保存为 PNG 并使用此免费服务进行转换:http: //www.convertico.com/

回答by Earth Engine

We have an application that works fine on 99% of our computers, but in one laptop it pops out this error.

我们有一个应用程序可以在我们 99% 的计算机上正常运行,但是在一台笔记本电脑上它会弹出这个错误。

It looks like our issue is that the laptop user set the screen text/image size to 150%. This could cause otherwise working images no longer working. We will see whether this works.

看起来我们的问题是笔记本电脑用户将屏幕文本/图像大小设置为 150%。这可能会导致其他工作图像不再工作。我们将看看这是否有效。

UPDATE

更新

A commenter seems to have the same problem. And yes, we resolved this problem by setting the screen text size to less than 150%.

评论者似乎有同样的问题。是的,我们通过将屏幕文本大小设置为小于 150% 解决了这个问题。