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)

Sorry, comments have been closed for this post.
(default) 11 queries took 7 ms
NrQueryErrorAffectedNum. rowsTook (ms)
1DESCRIBE `posts`17171
2DESCRIBE `comments`11111
3DESCRIBE `tags`221
4DESCRIBE `categories`221
5DESCRIBE `posts_tags`221
6DESCRIBE `categories_posts`221
7SELECT `Post`.`id`, `Post`.`url`, `Post`.`title`, `Post`.`icon`, `Post`.`metadesc`, `Post`.`metakeys`, `Post`.`categories`, `Post`.`tease`, `Post`.`body`, `Post`.`private_body`, `Post`.`created`, `Post`.`modified`, `Post`.`status`, `Post`.`allow_comments`, `Post`.`tags`, `Post`.`hitcount`, `Post`.`hitcount_rss` FROM `posts` AS `Post` WHERE `Post`.`url` = 'dynamically-create-a-firemonkey-drop-shadow' LIMIT 1110
8SELECT `Comment`.`id`, `Comment`.`post_id`, `Comment`.`body`, `Comment`.`author`, `Comment`.`url`, `Comment`.`email`, `Comment`.`ip`, `Comment`.`status`, `Comment`.`junk_score`, `Comment`.`created`, `Comment`.`modified` FROM `comments` AS `Comment` WHERE `Comment`.`status` = 2 AND `Comment`.`post_id` = (86) 111
9SELECT `Tag`.`id`, `Tag`.`tag`, `PostsTag`.`post_id`, `PostsTag`.`tag_id` FROM `tags` AS `Tag` JOIN `posts_tags` AS `PostsTag` ON (`PostsTag`.`post_id` = 86 AND `PostsTag`.`tag_id` = `Tag`.`id`) 660
10SELECT `Category`.`id`, `Category`.`category`, `CategoriesPost`.`post_id`, `CategoriesPost`.`category_id` FROM `categories` AS `Category` JOIN `categories_posts` AS `CategoriesPost` ON (`CategoriesPost`.`post_id` = 86 AND `CategoriesPost`.`category_id` = `Category`.`id`) 110
11UPDATE `posts` AS `Post` SET `Post`.`hitcount` = Post.hitcount + 1 WHERE `Post`.`id` = 8610