X3

RedSky

导航

WPF Bitmap转BitmapSource,Image

//引用:
using
System.Windows.Interop; //Imaging
using System.Drawing; //Bitmap


public static
Imaging.BitmapSource ConvertToBitmapSource(Bitmap btmap)
{
return Imaging.CreateBitmapSourceFromHBitmap(btmap.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
}

 

posted on 2019-03-25 16:13  HotSky  阅读(1631)  评论(0编辑  收藏  举报