目录
一.查看文档
1.微软的官方文档显示ImageSource派生出BitmapSouce
2.所以只要转成BitmapSource就行
二.参考代码
private BitmapSource GetImageSouce(Bitmap bitmap)
{
BitmapSource img;
IntPtr hBitmap;
hBitmap=bitmap.GetHbitmap();
img = Imaging.CreateBitmapSourceFromHBitmap(
hBitmap,
IntPtr.Zero,
Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions());
return img;
}