Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
c#can';不要加载图标_C#_Windows_Icons - Fatal编程技术网

c#can';不要加载图标

c#can';不要加载图标,c#,windows,icons,C#,Windows,Icons,如何加载图标 以下是我的应用程序的构造函数: public MyApp() { this.InitializeComponent(); Icon icon = new Icon(@"/icons/tray.ico"); // Icon is instance of 'System.Drawing.Icon' } 当启动时,它会死掉,但有一个例外: Additional information: 'The invocation of the constructor on typ

如何加载图标

以下是我的应用程序的构造函数:

public MyApp()
{
   this.InitializeComponent();
   Icon icon = new Icon(@"/icons/tray.ico");
   // Icon is instance of 'System.Drawing.Icon'
}
当启动时,它会死掉,但有一个例外:

Additional information: 'The invocation of the constructor on type 'Locale.MyApp' that matches the specified binding constraints threw an exception.' Line number '5' and line position '9'.
是,图标存在(位于“/icons/tray.ico”)。
这个错误没有告诉我任何事情。

我发现很难相信,如果你注释掉那一行,错误就会消失?尝试捕捉并抛出异常消息。@terrybozzio你应该坚持为Zappa打鼓;-)正斜杠是Windows上的有效路径分隔符。