0

I have seen several examples like

How to Set Image Resource URI from Code-Behind

but haven't understood.

If I have the following solution

enter image description here

enter image description here

I want to set the uri for ita.png

 Stream iconStream = Application.GetResourceStream(new Uri(?????)).Stream;
  notifyIcon.Icon = new System.Drawing.Icon(iconStream);

thanks

Community
  • 1
  • 1
Patrick
  • 3,073
  • 2
  • 22
  • 60

1 Answers1

1

You can use pack URI syntax described here

In your case it would be something like this:

  Stream iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/Resources/Images/ITA.png")).Stream;
  notifyIcon.Icon = new System.Drawing.Icon(iconStream);
Anton Danylov
  • 1,491
  • 10
  • 16