WPF:System.Windows.Interop.InteropBitmap到System.Drawing.Bitmap
是否有方法将System.Windows.Interop.InteropBitmap转换为System.Drawing.BitmapWPF:System.Windows.Interop.InteropBitmap到System.Drawing.Bitmap,wpf,c#-4.0,interop,bitmap,Wpf,C# 4.0,Interop,Bitmap,是否有方法将System.Windows.Interop.InteropBitmap转换为System.Drawing.Bitmap 谢谢您可以使用CopyPixels获取像素,并使用中的代码将像素传递到位图。您可以进一步解释问题的背景吗?InteropBitmap不是要在WPF中呈现遗留位图元素吗?似乎您正在尝试从win32->WPF->win32开始。我可以使用下面的代码解决我的问题。msg.ThumbnailSource包含对象的System.Windows.Interop.Interop
谢谢您可以使用CopyPixels获取像素,并使用中的代码将像素传递到位图。您可以进一步解释问题的背景吗?InteropBitmap不是要在WPF中呈现遗留位图元素吗?似乎您正在尝试从win32->WPF->win32开始。我可以使用下面的代码解决我的问题。msg.ThumbnailSource包含对象的System.Windows.Interop.InteropBitmap类型
BitmapSource bmpSource = msg.ThumbnailSource as BitmapSource;
MemoryStream ms = new MemoryStream();
BitmapEncoder encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bmpSource));
encoder.Save(ms);
ms.Seek(0, SeekOrigin.Begin);
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(ms);