radstudio logo

dynamically create a Firemonkey drop shadow

Just a quick code example of how to dynamically create a drop shadow effect, pretty simple stuff but with the lack of documentation examples are rare so it seems. This example adds a drop shadow to a TMemo :-

Show Plain Text
Delphi code
  1. uses
  2. ...
  3.     FMX_Memo, FMX_Effects;
  4. ...
  5. var
  6.     memo: TMemo;
  7.     shadow: TShadowEffect;
  8. ...
  9.     memo := TMemo.Create(self);
  10.     memo.Parent := panel;
  11.     memo.Align := TAlignlayout.alClient;
  12.     memo.ReadOnly := true;
  13.     memo.WordWrap := true;
  14.  
  15.     shadow := TShadowEffect.Create(self);
  16.     shadow.Parent := memo;
  17.     memo.AddObject(shadow);
  18.  

For some reason I had problems adding a drop shadow effect to a TPanel with this same method, I'll give it another go when I have some time.

1 Responses to “dynamically create a Firemonkey drop shadow”

Hi, Is the AddObject method in memo really necesarry? What does it do? BTW Very nice style of the code presentation. (really legible)

Post a comment