【问题标题】:Multi Effect with FiremonkeyFiremonkey 的多重效果
【发布时间】:2017-02-26 17:05:13
【问题描述】:

使用 Firemonkey(柏林更新 2)是否可以在 TButton 上同时使用 TShadowEffect 和 TGlowEffect ?

要获得阴影效果,我需要禁用发光效果。

【问题讨论】:

    标签: delphi firemonkey effect


    【解决方案1】:

    制作复合组件:将 TButton 放入 TRectangle(形状);将 TShadowEffect 附加到 TButton 并将 TGlowEffect 附加到外部 TRectangle 容器。

    unit FMX_TwoEffects;
    
    interface
    
    uses
      System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
      FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Effects,
      FMX.Controls.Presentation, FMX.StdCtrls, FMX.Objects;
    
    type
      TForm2 = class(TForm)
        Button1: TButton;
        Rectangle1: TRectangle;
        ShadowEffect1: TShadowEffect;
        GlowEffect1: TGlowEffect;
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form2: TForm2;
    
    implementation
    
    {$R *.fmx}
    
    end.
    

    (FMX 文件)

    object Form2: TForm2
      Left = 0
      Top = 0
      Caption = 'Form2'
      ClientHeight = 146
      ClientWidth = 243
      FormFactor.Width = 320
      FormFactor.Height = 480
      FormFactor.Devices = [Desktop]
      DesignerMasterStyle = 0
      object Rectangle1: TRectangle
        Fill.Kind = None
        Position.X = 20.000000000000000000
        Position.Y = 20.000000000000000000
        Size.Width = 113.000000000000000000
        Size.Height = 37.000000000000000000
        Size.PlatformDefault = False
        Stroke.Kind = None
        object Button1: TButton
          Align = Client
          Size.Width = 113.000000000000000000
          Size.Height = 37.000000000000000000
          Size.PlatformDefault = False
          TabOrder = 0
          Text = 'Button1'
          object ShadowEffect1: TShadowEffect
            Distance = 5.000000000000000000
            Direction = 45.000000000000000000
            Softness = 0.300000011920929000
            Opacity = 0.600000023841857900
            ShadowColor = claBlack
          end
        end
        object GlowEffect1: TGlowEffect
          Softness = 0.400000005960464400
          GlowColor = claGold
          Opacity = 0.899999976158142100
        end
      end
    end
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-01-20
    • 1970-01-01
    • 1970-01-01
    • 2012-06-19
    • 1970-01-01
    • 2016-03-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多