简体   繁体   中英

WPF window inside a WinformHost Panel

I am showing a WPF exe window inside another WPF application using winform host.

I have created a panel in main application and set it as child of 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?

Also if I set Allowtransparency=True on child WPF application,The UI doesnt show up in hosting panel.

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. https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2644120-bring-back-the-hwndhost-isredirected-and-compositi

Mitigating AirSpace issues

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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