我仍在学习C#,但遇到了困难。我的问题是,我有一个托盘图标,需要在发生某些事情时更改。
我已将新图标添加为现有项目项,并尝试使用以下代码进行更改:
this.notifyIcon1.Icon = new Icon(GetType(), "newmailIcon.ico");
但是我遇到了以下错误:
Resource 'newmailIcon.ico' cannot be found in class 'Traym_Icon.Form1'.
我仍在学习C#,但遇到了困难。我的问题是,我有一个托盘图标,需要在发生某些事情时更改。
我已将新图标添加为现有项目项,并尝试使用以下代码进行更改:
this.notifyIcon1.Icon = new Icon(GetType(), "newmailIcon.ico");
Resource 'newmailIcon.ico' cannot be found in class 'Traym_Icon.Form1'.
GetType()
。这应该使用目录中的newmailIcon.ico
文件作为图标,而不是搜索它作为编译的资源。 - A Person