BaiduFMX

Форк
0
/
RotateTextDemoMain.pas 
97 строк · 2.6 Кб
1
unit RotateTextDemoMain;
2

3
interface
4

5
uses
6
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
7
  System.TypInfo,
8
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Objects,
9
  FMX.RotatingText, FMX.Controls.Presentation, FMX.StdCtrls, FMX.Ani,
10
  FMX.Layouts, FMX.ListBox;
11

12
type
13
  TRotatingTextDemoForm = class(TForm)
14
    rbTopToBottom: TRadioButton;
15
    rbBottomToTop: TRadioButton;
16
    GroupBox1: TGroupBox;
17
    FMXRotatingText1: TFMXRotatingText;
18
    Text1: TText;
19
    ListBox1: TListBox;
20
    GroupBox2: TGroupBox;
21
    rbSelectRight: TRadioButton;
22
    rbSelectLeft: TRadioButton;
23
    GridPanelLayout1: TGridPanelLayout;
24
    FMXRotatingText2: TFMXRotatingText;
25
    TextLeft: TText;
26
    TextRight: TText;
27
    Layout1: TLayout;
28
    procedure FormCreate(Sender: TObject);
29
    procedure rbTopToBottomChange(Sender: TObject);
30
    procedure ListBox1Change(Sender: TObject);
31
  private
32
    { Private declarations }
33
    function GetMoveTypeName(AType: TInterpolationType): string;
34
    function GetSelectRotatingText: TFMXRotatingText;
35
    function GetSelectText: TText;
36
  public
37
    { Public declarations }
38
  end;
39

40
var
41
  RotatingTextDemoForm: TRotatingTextDemoForm;
42

43
implementation
44

45
{$R *.fmx}
46

47
procedure TRotatingTextDemoForm.FormCreate(Sender: TObject);
48
begin
49
  ListBox1.ItemIndex := 0;
50
  TextLeft.Text := GetMoveTypeName(FMXRotatingText1.MovingType);
51
  TextRight.Text := GetMoveTypeName(FMXRotatingText2.MovingType);
52
  FMXRotatingText1.Start;
53
  FMXRotatingText2.Start;
54
end;
55

56
function TRotatingTextDemoForm.GetMoveTypeName(AType: TInterpolationType): string;
57
begin
58
  Result := GetEnumName(TypeInfo(TInterpolationType),Ord(AType));
59
end;
60

61
function TRotatingTextDemoForm.GetSelectRotatingText: TFMXRotatingText;
62
begin
63
  if rbSelectLeft.IsChecked then
64
    Result := FMXRotatingText1
65
  else
66
    Result := FMXRotatingText2;
67
end;
68

69
function TRotatingTextDemoForm.GetSelectText: TText;
70
begin
71
    if rbSelectLeft.IsChecked then
72
    Result := TextLeft
73
  else
74
    Result := TextRight;
75
end;
76

77
procedure TRotatingTextDemoForm.ListBox1Change(Sender: TObject);
78
begin
79
  GetSelectRotatingText().MovingType := TInterpolationType(ListBox1.ItemIndex);
80
  GetSelectText().Text := GetMoveTypeName(TInterpolationType(ListBox1.ItemIndex));
81
end;
82

83
procedure TRotatingTextDemoForm.rbTopToBottomChange(Sender: TObject);
84
begin
85
  if rbTopToBottom.IsChecked then
86
  begin
87
    FMXRotatingText1.RotatingDirection := TRotatingDirection.TopToBottom;
88
    FMXRotatingText2.RotatingDirection := TRotatingDirection.TopToBottom;
89
  end
90
  else
91
  begin
92
    FMXRotatingText1.RotatingDirection := TRotatingDirection.BottomToTop;
93
    FMXRotatingText2.RotatingDirection := TRotatingDirection.BottomToTop;
94
  end;
95
end;
96

97
end.
98

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.