0

I've created a custom .NET MyUserControl which uses a 3rd party c++ library to draw on the MyUserControl using the MyUserControl.Control.Handle.

When I place a child control (i.e. PictureBox) with BackgroundColor = Transparent over the MyUserControl, the transparency of picturebox does not work - the picturebox shows the original background color of MyUserControl -> as if the actual drawing by the lib is ignored.

Is there some way how to setup the picturebox so it is still transparent over MyUserControl?

BeauxArts
  • 23
  • 4
  • Possible duplicate of [Transparent background Label over PictureBox](http://stackoverflow.com/questions/9387267/transparent-background-label-over-picturebox) – Hans Passant Jan 15 '15 at 15:56

1 Answers1

0

This solution worked:

Overlay WinForms controls on DirectX content

Although there is one caveat. The PictureBox is actually used to draw the rubber band selection rectangle for mouse. Clearing up the top PictureBox, since it is transparent, requires invalidating the underlying MyUserControl which lies beneath it. Invalidating just the PictureBox is enough to display new canvas drawings in 'PictureBox' (current rubber band), but this doesn't clear up the old canvas drawings (previous rubber band).

This introduces a small flicker. If anybody has an idea for this, please post.

Community
  • 1
  • 1
BeauxArts
  • 23
  • 4