source: trunk/Packages/bgracontrols/testbgracontrols/uflashplayersetup.pas

Last change on this file was 2, checked in by chronos, 5 years ago
File size: 2.4 KB
Line 
1unit uflashplayersetup;
2
3{$mode objfpc}{$H+}
4
5interface
6
7uses
8 Forms, StdCtrls, ExtCtrls, BGRABitmap, BGRAVirtualScreen, BGRAButton,
9 BGRAFlashProgressBar, Classes, SysUtils;
10
11type
12
13 { TfrmFlashPlayerSetup }
14
15 TfrmFlashPlayerSetup = class(TForm)
16 btnQuit: TBGRAButton;
17 btnInstall: TBGRAButton;
18 FlashProgressbar: TBGRAFlashProgressBar;
19 LabelPercent: TLabel;
20 LabelPercentShadow: TLabel;
21 LabelPos: TLabel;
22 LabelPosShadow: TLabel;
23 Timer1: TTimer;
24 vsBody: TBGRAVirtualScreen;
25 vsButtonPanel: TBGRAVirtualScreen;
26 procedure Quit(Sender: TObject);
27 procedure FormCreate(Sender: TObject);
28 procedure vsBodyRedraw(Sender: TObject; Bitmap: TBGRABitmap);
29 procedure vsButtonPanelRedraw(Sender: TObject; Bitmap: TBGRABitmap);
30 procedure Button1Click(Sender: TObject);
31 procedure Timer1Timer(Sender: TObject);
32 public
33 procedure SetStatus(AText: string);
34 end;
35
36var
37 frmFlashPlayerSetup: TfrmFlashPlayerSetup;
38
39implementation
40
41{$R *.lfm}
42
43uses
44 bgrasamples;
45
46{ TfrmFlashPlayerSetup }
47
48procedure TfrmFlashPlayerSetup.Quit(Sender: TObject);
49begin
50 Close;
51end;
52
53procedure TfrmFlashPlayerSetup.FormCreate(Sender: TObject);
54begin
55 StyleButtonsSample(vsButtonPanel, ssFlashPlayer);
56end;
57
58procedure TfrmFlashPlayerSetup.vsBodyRedraw(Sender: TObject; Bitmap: TBGRABitmap);
59begin
60 DrawFlashPlayerBody(Bitmap);
61end;
62
63procedure TfrmFlashPlayerSetup.vsButtonPanelRedraw(Sender: TObject;
64 Bitmap: TBGRABitmap);
65begin
66 DrawFlashPlayerButtonPanel(Bitmap);
67end;
68
69procedure TfrmFlashPlayerSetup.Button1Click(Sender: TObject);
70begin
71 Timer1.Enabled := False;
72 FlashProgressbar.Value := 0;
73 Timer1.Enabled := True;
74 btnInstall.Enabled := False;
75 SetStatus('Initializing...');
76end;
77
78procedure TfrmFlashPlayerSetup.Timer1Timer(Sender: TObject);
79begin
80 if FlashProgressbar.Value < FlashProgressbar.MaxValue then
81 begin
82 FlashProgressbar.Value := FlashProgressbar.Value + 128;
83 SetStatus(IntToStr(FlashProgressbar.Value) + 'k/' + IntToStr(
84 FlashProgressbar.MaxValue) + 'k');
85 end
86 else
87 begin
88 Timer1.Enabled := False;
89 btnInstall.Enabled := True;
90 SetStatus('Done');
91 end;
92end;
93
94procedure TfrmFlashPlayerSetup.SetStatus(AText: string);
95var
96 percent: string;
97begin
98 LabelPos.Caption := AText;
99 LabelPosShadow.Caption := AText;
100 percent := IntToStr(round(FlashProgressbar.Value / FlashProgressbar.MaxValue *
101 100)) + '%';
102 LabelPercent.Caption := percent;
103 LabelPercentShadow.Caption := percent;
104end;
105
106end.
Note: See TracBrowser for help on using the repository browser.