简体   繁体   English

WinformHost面板内的WPF窗口

[英]WPF window inside a WinformHost Panel

I am showing a WPF exe window inside another WPF application using winform host. 我正在使用winform主机在另一个WPF应用程序中显示WPF exe窗口。

I have created a panel in main application and set it as child of winformhost. 我在主应用程序中创建了一个面板,并将其设置为winformhost的子代。

  mHostingPanel = new System.Windows.Forms.Panel()
            {
                BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
            };                


            mWinformHost = new WindowsFormsHost();
            mWinformHost.Child = mHostingPanel;

and then I start the other window process and set hosting panel as parent. 然后我启动其他窗口进程并将托管面板设置为父级。

  WindowsAPI.SetParent(mProcess.MainWindowHandle, mHostingPanel.Handle);

My question is if I launch the application,Who will be rendering my Child WPF window whose parent is a winform panel.Will it be Direct-X or GDI context of Panel? 我的问题是,如果我启动应用程序,谁将呈现我的Child WPF窗口,其父级是winform面板。它将是Panel的Direct-X或GDI上下文?

Also if I set Allowtransparency=True on child WPF application,The UI doesnt show up in hosting panel. 此外,如果我在子WPF应用程序上设置Allowtransparency = True,则UI不会显示在主机面板中。

Found the reason.Its called airspace issue (when win32 and WPF trying to share pixels) and I dont think it can be solved by any framework API as microsoft denied it. 找到原因。它被称为空域问题(当win32和WPF试图共享像素时)我不认为它可以通过任何框架API解决,因为微软否认它。 https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2644120-bring-back-the-hwndhost-isredirected-and-compositi https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2644120-bring-back-the-hwndhost-isredirected-and-compositi

Mitigating AirSpace issues 减轻AirSpace问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM