isa
isa

Reputation: 1085

Cutting out part of a firemonkey form by setting transparent color doesn't work?

I want to cut out part of a firemonkey form, by calling SetLayeredWindowAttributes with LWA_COLORKEY, the black parts of the form becomes click through but not transparent?

uses
Winapi.Windows, FMX.Platform.Win

SetWindowLong(FmxHandleToHWND(Form1.Handle), GWL_EXSTYLE, GetWindowLong(FmxHandleToHWND(Form1.Handle), GWL_EXSTYLE) or WS_EX_LAYERED);
SetLayeredWindowAttributes( FmxHandleToHWND(Form1.Handle), RGB(0,0,0), 70, LWA_COLORKEY );

Upvotes: 2

Views: 953

Answers (1)

SilverWarior
SilverWarior

Reputation: 8386

If you check the SetLayeredWindowAttributes function definition you will see that third parameter defines the alpha value to describe the opacity of the layered window.

You have set this to 70 which is about 27 percent transparency.

You should set this to 0 if you want compleete transparancy.

EDIT: I guesed this should work for both VCL and FMX applications since SetLayeredWindowAttributes is a windows API function but I gues I was wrong.

I did however find a question about how to set partial transparency for whole FMX from here on SO AlphaBlend in FireMonkey

Maybe you could modify that code to only make parts of your form transparent.

Upvotes: 2

Related Questions