Search code examples
c#bitmapnotifyicon

How can I load NotifyIcon from Resources using C#


I want load icon from Resources.

I am using code:

Resources.myImage

It is Bitmap.

I need:

System.Windows.Forms.NotifyIcon.

How can I load image like a System.Windows.Forms.NotifyIconor use some convert?

Thank you for your help.


Solution

  • NotifyIcon is the class to show an icon on the tray, not the icon per se.

    NotifyIcon has a property named Icon, that's what you want to set, create a new NotifyIcon and then set it's Icon property to the resource.

    Also, remember Icon is of type "Icon", not "Bitmap", you need a .ico file.