Search code examples
c#transparencyalphablending

C# Alpha Blend Transparent PictureBox


I have a webcam feed being displayed on my form and would like to draw on top of it. I was going to do this using a picture box, I have found the PictureBox doesn't support true transparency instead just the colour of the form it's on. It also doesn't support alphablending which is how I would want it to display, similar to how forms can be made to appear.

Does anyone know how to do this? Or have a control implemented that can do this?


Solution

  • In most circumstances OwenP's answer of doing this using the method Bob Powell demonstrated in transcontrols will work. However, because it was a direct draw interface to the webcam ,the live feed always seemed to be on top of the other controls.

    To solve this I cheated a little and created a secondary form that opens over the video feed - this had no borders, was set to always on top, and given transparency - I drew directly onto this form. I then just had to handle a few events in this secondary form to keep focus on the original form and handle when another program is in use.