我已经使用了这个博客中的代码,如下所示,但是我在主窗口中看到了WinForm,但是我在标签上放置的示例文本是不可见的.
[System.Windows.Markup.ContentProperty("Child")]
public class WinFormsHost : HwndHost
{
public WinFormsHost()
{
var form = new ChildForm();
Child = form;
}
private System.Windows.Forms.Form child;
public event EventHandler<ChildChangedEventArgs> ChildChanged;
public System.Windows.Forms.Form Child
{
get { return child; }
set
{
HwndSource ps = PresentationSource.FromVisual(this) as HwndSource;
if (ps != null && ps.Handle != IntPtr.Zero)
{
throw new InvalidOperationException("Cannot set the Child property after the layout is done.");
}
Form oldChild = child;
child = value;
OnChildChanged(oldChild);
}
}
private void …
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建 WPF GUI 应用程序来托管已经存在的 QT GUI 应用程序作为主 UI 的一部分。
QT 应用程序不需要处理鼠标/键盘输入。
我已经尝试过这个SO Post 中提到的方法。似乎所有这些方法都不适用于 QT 应用程序。