Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create transparent labels over a Video control

I'm pretty much out of ideas here... for everything else, setting the background color to Color.Transparent or setting the TransparencyKey works fine...

I have an mp4 Video which I need to play as a "background" of my form. To do this, I'm currently using the WMP control. My problem: I can't add any controls on top of it, since they always render a background. Which looks ** on the video...

Any suggestions?

like image 419
Michael Avatar asked Oct 31 '11 14:10

Michael


2 Answers

A hack I've used successfully in a similar situation:

  • Create a separate, borderless, transparent form (transparency works best at the Form level)
  • Host button controls on that form
  • Launch the control form when your video form launches
  • Wire event handling such that the floating form always moves, resizes etc. whenever the main form changes
  • Calculate position of the floating for based on parent form's specs
  • Always push the floating form to the top, above the parent form

Told you it was a hack. But if you get all the events and calculations wired up it should work fine.

P.S. I also recall having to do a poll timer with a function that made sure every 250 millis or so that the Z-order of the two forms was what you wanted. (Switching apps and windows changed the z-order unexpectedly and w/o events, thus the polling solution.)

P.S. II It is very easy to prototype the feasibility of this solution. Just create a separate app with the above-mentioned specs and move it over your video. (You will need to retain the Form border to be able to move/resize the window easily.)

like image 74
Paul Sasik Avatar answered Oct 05 '22 22:10

Paul Sasik


Try rendering your labels using GDI+:

You can see sample here: (the Using GDI+ for drawing images with transparency part): http://www.broculos.net/en/article/how-use-transparent-images-and-labels-windows-forms

like image 23
Variant Avatar answered Oct 05 '22 23:10

Variant