首页 > 其他 > 详细

图片读写

时间:2015-07-23 19:37:59      阅读:103      评论:0      收藏:0      [点我收藏+]

byte[] imge = File.ReadAllBytes(path);将图片读为二进制代码
System.IO.MemoryStream ms = new System.IO.MemoryStream(imge);//img是从数据库中读取出来的字节数组
ms.Seek(0, System.IO.SeekOrigin.Begin);
BitmapImage newBitmapImage = new BitmapImage();
newBitmapImage.BeginInit();
newBitmapImage.StreamSource = ms;//二进制代码转为图片
newBitmapImage.EndInit();
//BitmapImage image = new BitmapImage(new Uri(path, UriKind.Absolute));
img.Source = newBitmapImage;
File.Delete(path);

图片读写

原文:http://www.cnblogs.com/weiweiboqi/p/4671219.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!