문제

I set up a NotifyIcon to store my application in the system tray. For the Icon I was using

myNotifyIcon.Icon = new System.Drawing.Icon(@"c:\MyIcon.ico");

and this works. However I would like to store my icon in my project directory and refer to it where I deploy my app rather than have some external image. i tried just

myNotifyIcon.Icon = new System.Drawing.Icon("MyIcon.ico");

and this where i get the XamlParseException when I try to run the app. The image does exist in the root of my project. Does anyone know the solution to this? Should I be using a PNG instead? I tried researching Pack Uris but i was just getting more confused and i am not sure thats what i need here. Thanks!

도움이 되었습니까?

해결책

It sounds like you are not copying the icon to the deployment directory on build. Make sure the .ico is sitting alongside your .exe rather than just in your project directory.

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