2

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 );
isa
  • 1,055
  • 16
  • 26

1 Answers1

2

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.

Community
  • 1
  • 1
SilverWarior
  • 7,372
  • 2
  • 16
  • 22
  • it doesn't matter 70, 0 or 255, LWA_COLORKEY gives complete transparency to any RGB(0,0,0) color on the form, the above code works with delphi vcl but not firemonkey. – isa Aug 07 '14 at 07:54
  • Edited my answer with potentional solution found in another SO question. I can't test it out since I'm not at my development computer. – SilverWarior Aug 07 '14 at 08:25