c# WPF transparency over Winform controls

前端 未结 4 714
醉梦人生
醉梦人生 2021-02-08 23:02

I have a WPF control that I would like to overlay onto a WinForms application. So I have dutifully created a Element Host that can show the following WPF object:



        
相关标签:
4条回答
  • 2021-02-08 23:11

    You probably already tried this, but how about setting the Opacity on the User Control?

    0 讨论(0)
  • 2021-02-08 23:20

    That seems like the interop airspace problem.

    0 讨论(0)
  • 2021-02-08 23:24

    I think you're running into an airspace issue. AFAIK, you can't mix WPF transparency and ElementHost transparency since the ElementHost owns the airspace.

    There's a short blurb in the link about creating non-rectangular hwnds to host WPF content, and that may get you farther.

    Perhaps you can consider migrating more of the WinForms app to WPF?

    0 讨论(0)
  • 2021-02-08 23:26

    You should read this :Black background before loading a wpf controll when using ElementHost Just hide & show it (not cool but works)

    0 讨论(0)
提交回复
热议问题