如何在Winforms c#中解决System.Drawing.Icon.Initialize错误? [英] How to resolve System.Drawing.Icon.Initialize error in Winforms c#?

查看:365
本文介绍了如何在Winforms c#中解决System.Drawing.Icon.Initialize错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个Windows应用程序。在该应用程序中,我得到以下未处理的异常。

System.Reflection.TargetInvocationException:调用目标抛出了异常。 ---> System.ComponentModel.Win32Exception:句柄无效

在System.Drawing.Icon.Initialize(Int32 width,Int32 height)

在System.Drawing.Icon..ctor (SerializationInfo info,StreamingContext context)

---内部异常堆栈跟踪结束---

在System.RuntimeMethodHandle.SerializationInvoke(IRuntimeMethodInfo方法,Object target,SerializationInfo info ,StreamingContext&)





任何人请帮助我。在此先感谢。

I have developed an windows application. In that application i have got the following exception which is unhandled.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ComponentModel.Win32Exception: The handle is invalid
at System.Drawing.Icon.Initialize(Int32 width, Int32 height)
at System.Drawing.Icon..ctor(SerializationInfo info, StreamingContext context)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.SerializationInvoke(IRuntimeMethodInfo method, Object target, SerializationInfo info, StreamingContext&)


Anyone Please help me. Thanks in advance.

推荐答案

您好,



我相信,这是一个与图标文件有关的问题。



您能否请将图标更换为更简单的图标并测试您的应用程序?



如果仍然面临这种情况,请将.ico文件粘贴到可执行文件所在的目录中。



其中任何一个都应该有希望修复。



Happy Coding !!
Hello,

I believe, its a problem related to the icon file.

Can you please check by replacing the icon to a much simpler one and test your app?

If still facing this, please paste the .ico file in the same directory as the executable is present.

Either of them should hopefully fix.

Happy Coding !!


这篇关于如何在Winforms c#中解决System.Drawing.Icon.Initialize错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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