本文介绍了如何转换一个简单的数据流(HTTP WebResponse类)中的C#Windows 8的BitmapImage?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我尝试1000次,转换成一个简单的数据流(HTTP WebResponse类),以BitmapImage的,但没有一个教程是工作在C#中的Windows 8 例如: 的BitmapImage形象=新的BitmapImage(); image.SetSource(流); image1.Source =图像; 感谢对所有答复。 解决方案 InMemoryRandomAccessStream randomAccessStream =新InMemoryRandomAccessStream(); DataWriter作家=新DataWriter(randomAccessStream.GetOutputStreamAt(0)); writer.WriteBytes((字节[])命令); 等待writer.StoreAsync(); 的BitmapImage形象=新的BitmapImage(); image.SetSource(randomAccessStream); 解决方案 您是否尝试过这个? InMemoryRandomAccessStream randomAccessStream =新InMemoryRandomAccessStream(); DataWriter作家=新DataWriter(randomAccessStream.GetOutputStreamAt(0)); writer.WriteBytes(response.Content.ReadAsByteArray()); 的BitmapImage形象=新的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.SolutionInMemoryRandomAccessStream randomAccessStream = new InMemoryRandomAccessStream();DataWriter writer = new DataWriter(randomAccessStream.GetOutputStreamAt(0));writer.WriteBytes((byte[])command);await writer.StoreAsync();BitmapImage image = new BitmapImage();image.SetSource(randomAccessStream); 解决方案 Have you tried this?InMemoryRandomAccessStream randomAccessStream = new InMemoryRandomAccessStream();DataWriter writer = new DataWriter(randomAccessStream.GetOutputStreamAt(0));writer.WriteBytes(response.Content.ReadAsByteArray());BitmapImage image = new BitmapImage();image.SetSource(randomAccessStream); 这篇关于如何转换一个简单的数据流(HTTP WebResponse类)中的C#Windows 8的BitmapImage?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-30 16:52