How can I change AlphaBlend
value (of a form) in a FireMonkey Desktop Application? Well It's available in VCL Application but I couldn't find it in FireMonkey.
Screenshot:
To make your form background semitransparent you should set form Transparency
property to true
and use Fill.Color
with alpha value like $AAFFFFFF
(with Fill.Kind = bkSolid
).
in this case form border becomes invisible (at least in Delphi XE2)
if you need to make all components at form semitransparent then place TLayout
on form with Align = alContents
and set its Opacity
property to required value.
if you need semitransparent window with alpha blend as it was in VCL you can use the same methods (for Windows platform) as getWindowLong/SetWindowLong
. Set transparency
back to false
and use code like this in form OnCreate
event handler:
implementation
uses fmx.platform.win, winapi.windows;
{$R *.fmx}
procedure TMainForm.FormCreate(Sender: TObject);
var h : HWND;
aStyle : integer;
alphaValue : byte;
begin
h := WindowHandleToPlatform(self.Handle).Wnd;
AStyle := GetWindowLong(h, GWL_EXSTYLE);
SetWindowLong(h, GWL_EXSTYLE, AStyle or WS_EX_LAYERED);
AlphaValue := 125;
SetLayeredWindowAttributes(h, 0, alphaValue, LWA_ALPHA);
end;
of course all your components become trasparent too.