I want to use the GDI+ drawing in my WPF control.
There are several ways to do this, the easiest would be to lock your Bitmap you manipulated with GDI, get the pixel buffer (Scan0 IntPtr in the BitmapData you get from the lock). CopyMemory(...) from you pixel buffer to a WriteableBitmap.BackBuffer.
There are more performant ways in WPF, like using the InteropBitmap instead of WriteableBitmap. But that needs more p/invoke.
Try compositing a Windows Form User Control in your WPF project and encapsulate GDI+ drawing in it. See Walkthrough: Hosting a Windows Forms User Control by Using the WPF Designer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With