문제

I'm still learning C# and I'm stuck. My problem is that I have a tray icon, which has to be changed when somthing happens.

I have added the new icon as an existing item to the project and I'm trying to change it by using this code:

this.notifyIcon1.Icon = new Icon(GetType(), "newmailIcon.ico");

But I'm getting the following error:

Resource 'newmailIcon.ico' cannot be found in class 'Traym_Icon.Form1'.
도움이 되었습니까?

해결책

You have to manually add your newmailIcon.ico as a resource file in your project.

다른 팁

right click on your image, click propereties and at the Build action, choose Embed.

or create a .resx in which you will keep your icons.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top