//Bitmap转换成Image
using System.IO;
private static System.Windows.Controls.Image Bitmap_To_Image(System.Drawing.Bitmap Bi)
{
MemoryStream ms = new MemoryStream();//内存流
Bi.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
BitmapImage bImage = new BitmapImage();
bImage.BeginInit();
bImage.StreamSource = new MemoryStream(ms.ToArray());
bImage.EndInit();
ms.Dispose();
Bi.Dispose();
System.Windows.Controls.Image image = new System.Windows.Controls.Image();
image.Source = bImage;
return image ;
} |