负载字节[]为在运行时System.Windows.Controls.Image [英] Load byte[] into a System.Windows.Controls.Image at Runtime

查看:131
本文介绍了负载字节[]为在运行时System.Windows.Controls.Image的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表示.png文件一个byte []。我下载通过Web客户端这个巴纽。当Web客户端已下载我通过URL引用巴纽,我得到一个byte []。我的问题是,我怎么一个byte []加载到在WPF中System.Windows.Controls.Image元素?谢谢

I have a byte[] that represents a .png file. I am downloading this .png via a WebClient. When the WebClient has downloaded the .png I reference via a URL, I get a byte[]. My question is, how do I load a byte[] into a System.Windows.Controls.Image element in WPF? Thank you.

请注意:这是我在这里问的问题补充:的 http://stackoverflow.com/questions/582805/load-a-byte-into-an-image-at-runtime 。我是不是在我原来的问题不够具体,但答案仍然是有意义的。

Note: This is complementary to the question I asked here: http://stackoverflow.com/questions/582805/load-a-byte-into-an-image-at-runtime. I was not specific enough in my original question, but the answers were still relevant.

推荐答案

使用的 PngBitmapDecoder 。该文档显示用法示例。

Use a PngBitmapDecoder. The docs show example usage.

这篇关于负载字节[]为在运行时System.Windows.Controls.Image的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆