Opaque (semi-trasparent) control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I neet to create a "Colored glass" effect, so I can cover a couple of buttons
on my form with an opaque (semi-transparent) shape and some text. I tried the
following:

1. Create a control that will support a transparent background and use ARGB
colors to set an opacity for the background (or implement custom
paintbackground). I was able to create kinda "label with transparent
background" control using text clipping technique, but not an "opaque"
background. Playing with SetStyle (AllPaintingInWmPaint, Opaque,
SupportsTransparentBackColor, ...) I was able to "burn the hole in the form"
effect (the desktop was visible through, but not other controls on nmy form)

2. Create a custom container control that will be able to draw over its
children. However, I was not able to make Graphics to draw over the children
controls.

Is it possible to create an opaque control at all?

(I did a work around by placing a whole opaque Form over needed controls,
but that's not a solution I'm looking for)
 
It is a nice "trick" (Thanks for the info !) but unfortunatly, it is
absolutely not suitable for production. Using paren'ts invalidation on timer
causes a lot of flicking and still does not render correctly over several
types of controls, like ComboBox, (ComboBox's text will draw itself over the
"Transparent control" while the rest of the ComboBox will stay behind it -
weird) etc. Double buffering is not supported.

I'm still looking for another solution...

--
Thanks,
Viktar Z.


+ Kennedy Kok + said:
 
Hello Viktar,

I think the "best" solution is what you already have - using a Form and setting
it's transparency. Hopefully, vista will bring true-transparency on controls.

K
 
Back
Top