How do I use an icon that is a resource in WPF?

前端 未结 5 510
北荒
北荒 2020-11-29 20:06

I have a .ico file that is embedded as a resource (build action set to resource). I am trying to create a NotifyIcon. How can I reference my icon?

notifyIc         


        
5条回答
  •  南笙
    南笙 (楼主)
    2020-11-29 20:54

    If you are just looking for the simple answer, I think this is it where MyApp is your application name and where that's the root namespace name for your application. You have to use the pack URI syntax, but it doesn't have to be that complicated to pull an icon out of your embedded resources.

        
    

提交回复
热议问题