码迷,mamicode.com
首页 > Windows程序 > 详细

Bitmap转换成BitmapImage

时间:2016-09-05 20:53:38      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:

 1 public BitmapImage BitmapToBitmapImage(System.Drawing.Bitmap bitmap)
 2         {
 3             MemoryStream ms = new MemoryStream();
 4             Properties.Resources.skin.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
 5             BitmapImage bit3 = new BitmapImage();
 6             bit3.BeginInit();
 7             bit3.StreamSource = ms;
 8             bit3.EndInit();
 9             return bit3;
10         }

skin是资源文件中的文件名,类型为png。

不知道效率怎么样。

看了下面的文章,感觉效率不怎么样,想寻找一种好一点的方法:

http://blog.csdn.net/yxlnmj/article/details/5801842

Bitmap转换成BitmapImage

标签:

原文地址:http://www.cnblogs.com/zhaotianff/p/5843449.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!