views:

352

answers:

1

I'm looking after a way to AlphaBlend a child form, if possible using layered windows as there will be interactive controls behind it.

The problem is I have a component in a regular TForm that paints multiple visual layers (drawings, pictures...). At some point I need to instantiate an editor control on this form (in-place), this control will involve a variety of standard input controls outside of my control (edit box, check box, etc.), however I would like to overlay the layers in front of the layer being edited using alpha blending (and WS_EX_TRANSPARENT to make it click-through).

I first thought of using child forms for that (borderless TForms parented to the component), and that works alright, up to the point where the AlphaBlended TForm isn't alphablended at all, but turns opaque as soon as parented...

I then tried to unparent the alphablended form, set it to fsStayOnTop, and by reacting to the relevant events, keep it in front of the component on screen, that works, but that isn't a truly satisfying solution: the alphablended StayOnTop form is also in front of other modal and modeless forms of the application, should the user decide to move them in front of the component...

So, any other ideas on a way to have a child form be alphablended? (or behave like it is)

+2  A: 

According to MSDN you are out of luck, as WS_EX_LAYERED cannot be used for child windows.

Maybe you could hide all editor forms when your form / application loses focus, that would at least keep them from being on top of other windows. Still, it's unsatisfactory...

mghie
Thanks, I was afraid of it.I've solved by getting the spec rewritten and having the overlay visible only "outside" of input controls in the edit form (the edit form will be transparent, the edit area of the input controls on it won't be).Since the overlay was to be used mostly for positioning purposes and guidelines, this is "good enough", if not fully satisfying.