使用png图像作为图标流 [英] Use a png image for icons stream
本文介绍了使用png图像作为图标流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我使用一个代码示例(WpfXamlPopup)来加载图标和流.
但是我会用一个. Png而不是一个. Ico.
如何转换. ng ICO,然后流此对象?
原始代码
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);
谢谢
Thanks
推荐答案
您应该在StackOverflow上查看以下线程:
http://stackoverflow.com/questions/384931/how-do-i-get-an-icon-from-a-png-image [
You should take a look at this thread on StackOverflow:
http://stackoverflow.com/questions/384931/how-do-i-get-an-icon-from-a-png-image[^]
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!
这篇关于使用png图像作为图标流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文