有沒有辦法將System.Windows.Interop.InteropBitmap轉換爲System.Drawing.Bitmap?WPF:System.Windows.Interop.InteropBitmap到System.Drawing.Bitmap
謝謝
有沒有辦法將System.Windows.Interop.InteropBitmap轉換爲System.Drawing.Bitmap?WPF:System.Windows.Interop.InteropBitmap到System.Drawing.Bitmap
謝謝
我能夠使用下面的代碼解決我的問題。 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);
你可以使用CopyPixels採取的像素,並使用代碼the Bitmap.Lock/Unlock documentation到像素傳遞給位圖。
你能解釋一下問題的背景嗎? InteropBitmap是不是意味着在WPF中渲染遺留位圖元素?似乎你想從win32 - > WPF - > win32。