How to set Win32 window as owner of WPF window?

后端 未结 2 1293
余生分开走
余生分开走 2020-12-17 14:35

I want to use WPF windows in a legacy win32 application. I\'d like to behave them in a similar way, like the WPF window always being displayed on top of the win32 window.

相关标签:
2条回答
  • 2020-12-17 15:05

    How about SetParent()? I know works when making a WPF window an MDI Child of a Windows Form.

    0 讨论(0)
  • 2020-12-17 15:08

    This article shows how to get the handles for both as well as how to make the WPF window become a transparent overlay for the win32 window.

    http://blogs.microsoft.co.il/blogs/tamir/archive/2007/04/11/Transparent-WPF-control-over-unmanaged-window-handle.aspx

    This article uses a WindowInteropHelper to accomplish similar functionality.

    http://blogs.msdn.com/wpfsdk/archive/2007/04/03/centering-wpf-windows-with-wpf-and-non-wpf-owner-windows.aspx

    MSDN page on WindowInteropHelper:

    http://msdn.microsoft.com/en-us/library/system.windows.interop.windowinterophelper.aspx

    Hope that helps, Ed

    0 讨论(0)
提交回复
热议问题