标签: wpf-interop

为什么我的WPF托管WinForm空白?

我已经使用了这个博客中的代码,如下所示,但是我在主窗口中看到了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)

c# wpf winforms-interop winforms wpf-interop

8
推荐指数
1
解决办法
1056
查看次数

是否可以将 QT 应用程序托管到 WPF 应用程序中?

我正在尝试创建 WPF GUI 应用程序来托管已经存在的 QT GUI 应用程序作为主 UI 的一部分。

QT 应用程序不需要处理鼠标/键盘输入。

我已经尝试过这个SO Post 中提到的方法。似乎所有这些方法都不适用于 QT 应用程序。

在此处输入图片说明

wpf qt winforms-interop wpf-interop

5
推荐指数
1
解决办法
1315
查看次数

标签 统计

winforms-interop ×2

wpf ×2

wpf-interop ×2

c# ×1

qt ×1

winforms ×1