form:Transparent, Control on form:non Transparent?

2019-04-14 13:06发布

问题:

How can change alphablend of a form without affect on control in form?

Delphi XE7

回答1:

One solution to this problem is to use Multi-Device Application (if using VCL is not possible).

If you need to leave a transparent TForm just changing a property Transparency = True.

If you need to leave a semi-transparent component, all components have the Opacity property that can be assigned a more transparent value between 0 and 1, where 0 is closer to that component.

For example you could put the controls within a TLayout and change the Opacity of it as you see fit, and have no effect on the other components, or vice versa.



回答2:

Actually the answer to this might be pretty simple...(for windows only)

The JEDI VCL library has a component (TJvTransparentForm) that allows you to take an Alpha blended PNG image (ie the gray background shown in your picture above) and use it to make a form control. The picture is actually stored in a TImage and you would need to place your "Icons" on the image itself. Then just respond to the mouse clicks on the TImage.

You have what your asking for (maybe?).

If you were tricky enough you could probably even track the mouse movement and change the Image to glow the correct "button" that the mouse was over.