I have a WPF application with a Windows Form element hosted inside it, using this method:
System.Windows.Forms.Integration.WindowsFormsHost host =
new System.Windows.Forms.Integration.WindowsFormsHost();
gMapZoom = new GMap();
gMapZoom.Paint += new PaintEventHandler(gMapZoom_Paint);
host.Child = gMapZoom; // gMapZoom is the Windows Form control
// Add the interop host control to the Grid
// control's collection of child controls.
this.grid1.Children.Add(host);
However, I'm having problems trying to add a custom Paint event handler to it. It seems that adding it in WPF (not shown here) causes the drawing to be done beneath the WinForm control, so nothing appears on top. Adding it to the WinForm control does nothing whatsoever; the paint event (gMapZoom_Paint) is never even called.
Any help would be much appreciated.
You can add a PaintEventHandler event to your Windows Form Control (gMapZoom)
In WPF code behind:
Then you can trigger the OnPaint event by: