Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transparent background in WPF+WinFormsHost #140

Open
bigboynaruto opened this issue Jul 9, 2019 · 2 comments
Open

Transparent background in WPF+WinFormsHost #140

bigboynaruto opened this issue Jul 9, 2019 · 2 comments

Comments

@bigboynaruto
Copy link

Hi! I was wondering if it's possible to make GlControl's background transparent, so the parent WPF-control would be visible through it? Setting BackColor to something with alpha=0 doesn't seem to work.

@DanFTRX
Copy link

DanFTRX commented Jul 10, 2019

Short answer is no due to the Airgap issue. Long answer: https://blogs.msdn.microsoft.com/dwayneneed/2013/02/26/mitigating-airspace-issues-in-wpf-applications/

Alternative solution: Use FBO's to render to a WritableBitmap used an an ImageSource in an Image element within WPF.
See here for a basic POC: https://gist.github.com/DanFTRX/504be5c6e17098b86ef12342cd50c32d

Using a WriteableBitmap allows you to overlay things on top of it and otherwise manipulate the control the same as any other WPF Control. It does come at the cost of some performance though, but should be negligable in most cases.

@bigboynaruto
Copy link
Author

Thanks a lot, I'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants