【发布时间】:2012-02-09 04:09:58
【问题描述】:
我有一个 WPF 应用程序,其中托管了一个 Windows 窗体元素,使用此方法:
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);
但是,我在尝试向其添加自定义 Paint 事件处理程序时遇到问题。似乎在 WPF 中添加它(此处未显示)会导致绘图在 WinForm 控件下方完成,因此顶部不会出现任何内容。将它添加到 WinForm 控件中没有任何作用;绘制事件 (gMapZoom_Paint) 甚至从未被调用过。
任何帮助将不胜感激。
【问题讨论】:
标签: c# .net wpf winforms paint