wpf - WPF 中的 IWin32Window

标签 wpf winforms

我有一个 excel 插件,它公开 IWin32Window 作为它的主 UI。
我想显示一个使用它作为父级的 WPF 窗口。

我该怎么做?

最佳答案

您可以使用 WindowInteropHelper适本地为 WPF 窗口设置父级:

var helper = new WindowInteropHelper(theWpfWindow);
helper.Owner = win32Window.Handle;

theWpfWindow.Show(); // This is now parented appropriately

关于wpf - WPF 中的 IWin32Window,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5543509/

相关文章:

Wpf 文本 block 和滚动条

c# - 在 WPF 中播放动画 - 支持的图像格式?

c# - 图像不显示在 WPF 的现代 UI 中

c# - C#中如何使用SqlDataAdapter更新多行

c# - 在包含其他控件的 C# UserControl 中重写 OnPaint 和抓取鼠标事件的问题

c# - 为什么迭代 GetConsumingEnumerable() 没有完全清空底层阻塞集合

c# - 频谱分析仪用于输入?

C# Winforms 实时图表 : Fire Event when rendering of CartesianChart is finished

c# - 什么是 CCA 中托管应用程序的应用程序适配器?

c# - 在 ComboBox DataTemplate 中获取 TextBlock 的值