Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Hi I use a code sample (WpfXamlPopup) that loads an icon and stream.
But I would use one. Png instead of one. Ico.
How to convert. Png. Ico and then stream this object?

Original code
System.IO.Stream iconStream = Application.GetResourceStream(new Uri("pack://application:,,/Images/Test.ico")).Stream;
            extendedNotifyIcon.targetNotifyIcon.Icon = new System.Drawing.Icon(iconStream);

Test code(Error)
System.IO.Stream iconStream = Application.GetResourceStream(new Uri("pack://application:,,/Images/Test.png")).Stream;
            extendedNotifyIcon.targetNotifyIcon.Icon = new System.Drawing.Icon(iconStream);

Updated 16-Jun-11 21:59pm
Sergey Alexandrovich Kryukov 16-Jun-11 12:31pm    
Is it WPF? Tag it!
Member 7775060 17-Jun-11 2:27am    
OkIt's marked.

1 solution

You should take a look at this thread on StackOverflow:[^]

Personally, I'd convert the png to ico (the thread has a link to at tool to do that) as it is the path of least resistance, but it is always good to have the "full" solution!
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900