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上的有效路径分隔符。