source: cprs/branches/GUI-config/AboutU.pas@ 877

Last change on this file since 877 was 611, checked in by Kevin Toppenberg, 15 years ago

Allow user-definable splash.jpg image

File size: 3.4 KB
Line 
1unit AboutU;
2 (*
3 WorldVistA Configuration Utility
4 (c) 8/2008 Kevin Toppenberg
5 Programmed by Kevin Toppenberg, Eddie Hagood
6
7 Family Physicians of Greeneville, PC
8 1410 Tusculum Blvd, Suite 2600
9 Greeneville, TN 37745
10 kdtop@yahoo.com
11
12 This library is free software; you can redistribute it and/or
13 modify it under the terms of the GNU Lesser General Public
14 License as published by the Free Software Foundation; either
15 version 2.1 of the License, or (at your option) any later version.
16
17 This library is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
21
22 You should have received a copy of the GNU Lesser General Public
23 License along with this library; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 *)
26
27interface
28
29uses
30 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
31 Dialogs, StdCtrls, jpeg, ExtCtrls;
32
33type
34 TAboutForm = class(TForm)
35 Image1: TImage;
36 Memo1: TMemo;
37 Timer1: TTimer;
38 procedure FormClick(Sender: TObject);
39 procedure Timer1Timer(Sender: TObject);
40 procedure FormShow(Sender: TObject);
41 private
42 { Private declarations }
43 FadeIn : boolean;
44 public
45 { Public declarations }
46 end;
47
48var
49 AboutForm: TAboutForm;
50
51implementation
52
53uses MainU;
54
55{$R *.dfm}
56
57 const MIN_ALPHA = 50;
58 TIMER_SPEED = 10;
59
60 procedure TAboutForm.FormClick(Sender: TObject);
61 begin
62 Timer1.Enabled := true;
63 FadeIn := false;
64 Timer1.Interval := TIMER_SPEED;
65 AboutForm.AlphaBlendValue := 255;
66 end;
67
68 procedure TAboutForm.Timer1Timer(Sender: TObject);
69 var i : integer;
70 const delta = 5;
71 begin
72 if FadeIn then begin
73 if AboutForm.AlphaBlendValue < 255 then begin
74 i := AboutForm.AlphaBlendValue;
75 i := i +delta;
76 if i > 255 then begin
77 i := 255;
78 Timer1.Enabled := false;
79 end;
80 AboutForm.AlphaBlendValue := i;
81 end else begin
82 Timer1.Enabled := false;
83 end;
84 end else begin
85 if AboutForm.AlphaBlendValue > MIN_ALPHA then begin
86 i := AboutForm.AlphaBlendValue;
87 i := i - delta;
88 if i < MIN_ALPHA then i := MIN_ALPHA;
89 AboutForm.AlphaBlendValue := i;
90 end else begin
91 Timer1.Enabled := false;
92 MainForm.Show;
93 Close;
94 end;
95 end;
96 end;
97
98 procedure TAboutForm.FormShow(Sender: TObject);
99 var FileName : string;
100 begin
101 FileName := ExtractFilePath(ParamStr(0))+ 'splash.jpg';
102 if FileExists(FileName) then begin
103 Image1.Picture.LoadFromFile(FileName);
104 end;
105 Image1.Width := Image1.Picture.Width;
106 Image1.Height := Image1.Picture.Height;
107 Self.Width := Image1.Picture.Width;
108 Self.Height := Image1.Picture.Height + Memo1.Height + 35; //not sure why 35 extra needed...
109 Self.Left:=(Screen.Width - Self.Width) div 2;
110 Self.Top := (Screen.Height - Self.Height) div 2;
111 MainForm.Hide;
112
113 Timer1.Enabled := true;
114 FadeIn := true;
115 Timer1.Interval := TIMER_SPEED;
116 AboutForm.AlphaBlendValue := MIN_ALPHA;
117 end;
118
119end.
120
Note: See TracBrowser for help on using the repository browser.