大佬教程收集整理的这篇文章主要介绍了windows-phone-7 – 如何将图像从隔离存储加载到Windows Phone上的图像控制?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
void camera_Completed(object sender,PhotoResult E) { BitmapImage objImage = new BitmapImage(); //objImage.Setsource(e.ChosenPhoto); //Own_Image.source = objImage; using (var isolatedStorage = IsolatedStorageFile.GetUserStoreForApplication()) { fnam = e.originalFilename.SubString(93); messageBox.Show(fnam); if (isolatedStorage.FileExists(fnam)) isolatedStorage.deleteFile(fnam); IsolatedStorageFileStream fileStream = isolatedStorage.CreateFile(fnam); BitmapImage bitmap = new BitmapImage(); bitmap.Setsource(e.ChosenPhoto); WriteableBitmap wb = new WriteableBitmap(bitmap); wb.SaveJpeg(fileStream,wb.PixelWidth,wb.PixelHeight,100,100); messageBox.Show("File Created"); fileStream.Close(); } }
现在我想从隔离存储中取出图像并将其显示在我的图像控件中.
可能吗?
private static BitmapImage GetImageFromIsolatedStorage(String imageName) { var bimg = new BitmapImage(); using (var iso = IsolatedStorageFile.GetUserStoreForApplication()) { using (var stream = iso.openFile(imagename,FileMode.open,FileAccess.Read)) { bimg.Setsource(stream); } } return bimg; }
用法:
ImageControl.source = GetImageFromIsolatedStorage(fnam);
以上是大佬教程为你收集整理的windows-phone-7 – 如何将图像从隔离存储加载到Windows Phone上的图像控制?全部内容,希望文章能够帮你解决windows-phone-7 – 如何将图像从隔离存储加载到Windows Phone上的图像控制?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。