BaiduFMX
97 строк · 2.6 Кб
1unit RotateTextDemoMain;
2
3interface
4
5uses
6System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
7System.TypInfo,
8FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Objects,
9FMX.RotatingText, FMX.Controls.Presentation, FMX.StdCtrls, FMX.Ani,
10FMX.Layouts, FMX.ListBox;
11
12type
13TRotatingTextDemoForm = class(TForm)
14rbTopToBottom: TRadioButton;
15rbBottomToTop: TRadioButton;
16GroupBox1: TGroupBox;
17FMXRotatingText1: TFMXRotatingText;
18Text1: TText;
19ListBox1: TListBox;
20GroupBox2: TGroupBox;
21rbSelectRight: TRadioButton;
22rbSelectLeft: TRadioButton;
23GridPanelLayout1: TGridPanelLayout;
24FMXRotatingText2: TFMXRotatingText;
25TextLeft: TText;
26TextRight: TText;
27Layout1: TLayout;
28procedure FormCreate(Sender: TObject);
29procedure rbTopToBottomChange(Sender: TObject);
30procedure ListBox1Change(Sender: TObject);
31private
32{ Private declarations }
33function GetMoveTypeName(AType: TInterpolationType): string;
34function GetSelectRotatingText: TFMXRotatingText;
35function GetSelectText: TText;
36public
37{ Public declarations }
38end;
39
40var
41RotatingTextDemoForm: TRotatingTextDemoForm;
42
43implementation
44
45{$R *.fmx}
46
47procedure TRotatingTextDemoForm.FormCreate(Sender: TObject);
48begin
49ListBox1.ItemIndex := 0;
50TextLeft.Text := GetMoveTypeName(FMXRotatingText1.MovingType);
51TextRight.Text := GetMoveTypeName(FMXRotatingText2.MovingType);
52FMXRotatingText1.Start;
53FMXRotatingText2.Start;
54end;
55
56function TRotatingTextDemoForm.GetMoveTypeName(AType: TInterpolationType): string;
57begin
58Result := GetEnumName(TypeInfo(TInterpolationType),Ord(AType));
59end;
60
61function TRotatingTextDemoForm.GetSelectRotatingText: TFMXRotatingText;
62begin
63if rbSelectLeft.IsChecked then
64Result := FMXRotatingText1
65else
66Result := FMXRotatingText2;
67end;
68
69function TRotatingTextDemoForm.GetSelectText: TText;
70begin
71if rbSelectLeft.IsChecked then
72Result := TextLeft
73else
74Result := TextRight;
75end;
76
77procedure TRotatingTextDemoForm.ListBox1Change(Sender: TObject);
78begin
79GetSelectRotatingText().MovingType := TInterpolationType(ListBox1.ItemIndex);
80GetSelectText().Text := GetMoveTypeName(TInterpolationType(ListBox1.ItemIndex));
81end;
82
83procedure TRotatingTextDemoForm.rbTopToBottomChange(Sender: TObject);
84begin
85if rbTopToBottom.IsChecked then
86begin
87FMXRotatingText1.RotatingDirection := TRotatingDirection.TopToBottom;
88FMXRotatingText2.RotatingDirection := TRotatingDirection.TopToBottom;
89end
90else
91begin
92FMXRotatingText1.RotatingDirection := TRotatingDirection.BottomToTop;
93FMXRotatingText2.RotatingDirection := TRotatingDirection.BottomToTop;
94end;
95end;
96
97end.
98