如何在 c# windows 8 中将简单的流(http webresponse)转换为位图图像?
我尝试了 1000 次,将一个简单的流(http webresponse)转换为位图图像,但没有一个教程可以在 c# windows 8 中工作。
示例:
BitmapImage image = new BitmapImage();
image.SetSource(stream);
image1.Source = image;
感谢所有回复。
解决方案
InMemoryRandomAccessStream randomAccessStream = new InMemoryRandomAccessStream();
DataWriter writer = new DataWriter(randomAccessStream.GetOutputStreamAt(0));
writer.WriteBytes((byte[])command);
await writer.StoreAsync();
BitmapImage image = new BitmapImage();
image.SetSource(randomAccessStream);
I try 1000 times, to convert a simple stream (http webresponse) to bitmapimage, but no one tutorial is working in c# windows 8.
Example:
BitmapImage image = new BitmapImage();
image.SetSource(stream);
image1.Source = image;
Thank's for all reply.
Solution
InMemoryRandomAccessStream randomAccessStream = new InMemoryRandomAccessStream();
DataWriter writer = new DataWriter(randomAccessStream.GetOutputStreamAt(0));
writer.WriteBytes((byte[])command);
await writer.StoreAsync();
BitmapImage image = new BitmapImage();
image.SetSource(randomAccessStream);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个代码:
Try this code:
你试过这个吗?
Have you tried this?