unit Unit1;
interface
uses
System.SysUtils, System.Types, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.Controls.Presentation, FMX.StdCtrls;
type
TForm1 =
class( TForm )
Button1: TButton;
StyleBook1: TStyleBook;
procedure Button1Click( Sender: TObject );
private
FGradient: TGradient;
public
procedure AfterConstruction;
override;
procedure BeforeDestruction;
override;
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
uses
System.Rtti, System.UITypes;
procedure TForm1.AfterConstruction;
begin
inherited;
FGradient := TGradient.Create;
FGradient.Color := TAlphaColors.White;
FGradient.Color1 := TAlphaColors.Crimson;
end;
procedure TForm1.BeforeDestruction;
begin
FGradient.Free;
inherited;
end;
procedure TForm1.Button1Click( Sender: TObject );
begin
case Button1.Tag
of
1:
begin
Button1.StylesData[ '
background.Fill.Kind' ] := TValue.From( TBrushKind.Solid );
Button1.StylesData[ '
background.Fill.Color' ] := TAlphaColors.Crimson;
Button1.StylesData[ '
background.Stroke.Color' ] := TAlphaColors.Crimson;
Button1.StylesData[ '
text.FocusedColor' ] := TAlphaColors.Antiquewhite;
Button1.StylesData[ '
text.HotColor' ] := TAlphaColors.Antiquewhite;
Button1.StylesData[ '
text.NormalColor' ] := TAlphaColors.Antiquewhite;
Button1.StylesData[ '
text.PressedColor' ] := TAlphaColors.Antiquewhite;
Button1.StylesData[ '
background.XRadius' ] := 10;
Button1.StylesData[ '
background.YRadius' ] := 10;
Button1.Tag := 0;
end;
0:
begin
Button1.StylesData[ '
background.Fill.Kind' ] := TValue.From( TBrushKind.Gradient );
Button1.StylesData[ '
background.Fill.Gradient' ] := FGradient;
Button1.StylesData[ '
background.Fill.Color' ] := TAlphaColors.Crimson;
Button1.StylesData[ '
background.Stroke.Color' ] := TAlphaColors.Crimson;
Button1.StylesData[ '
text.FocusedColor' ] := TAlphaColors.Black;
Button1.StylesData[ '
text.HotColor' ] := TAlphaColors.Black;
Button1.StylesData[ '
text.NormalColor' ] := TAlphaColors.Black;
Button1.StylesData[ '
text.PressedColor' ] := TAlphaColors.Black;
Button1.StylesData[ '
background.XRadius' ] := 3;
Button1.StylesData[ '
background.YRadius' ] := 3;
Button1.Tag := 1;
end;
end;
end;
end.