1 | {$INCLUDE Switches.inc}
|
---|
2 | unit Back;
|
---|
3 |
|
---|
4 | interface
|
---|
5 |
|
---|
6 | uses
|
---|
7 | LCLIntf, LCLType, SysUtils, Classes, Graphics, Forms, Controls;
|
---|
8 |
|
---|
9 | type
|
---|
10 |
|
---|
11 | { TBackground }
|
---|
12 |
|
---|
13 | TBackground = class(TForm)
|
---|
14 | procedure FormDestroy(Sender: TObject);
|
---|
15 | procedure FormPaint(Sender: TObject);
|
---|
16 | procedure FormShow(Sender: TObject);
|
---|
17 | procedure FormCreate(Sender: TObject);
|
---|
18 | procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
19 | private
|
---|
20 | Img: TBitmap;
|
---|
21 | public
|
---|
22 | procedure UpdateInterface;
|
---|
23 | end;
|
---|
24 |
|
---|
25 | var
|
---|
26 | Background: TBackground;
|
---|
27 |
|
---|
28 | implementation
|
---|
29 |
|
---|
30 | uses
|
---|
31 | Directories, ScreenTools, Start;
|
---|
32 |
|
---|
33 | {$R *.lfm}
|
---|
34 |
|
---|
35 | procedure TBackground.FormCreate(Sender: TObject);
|
---|
36 | begin
|
---|
37 | Img := nil;
|
---|
38 | end;
|
---|
39 |
|
---|
40 | procedure TBackground.FormShow(Sender: TObject);
|
---|
41 | begin
|
---|
42 | UpdateInterface;
|
---|
43 | end;
|
---|
44 |
|
---|
45 | procedure TBackground.FormDestroy(Sender: TObject);
|
---|
46 | begin
|
---|
47 | if Assigned(Img) then FreeAndNil(Img);
|
---|
48 | end;
|
---|
49 |
|
---|
50 | procedure TBackground.FormPaint(Sender: TObject);
|
---|
51 | begin
|
---|
52 | if Assigned(Img) then
|
---|
53 | BitBltCanvas(Canvas, Screen.Width - Img.Width - (Screen.Width - 800) *
|
---|
54 | 3 div 8, (Screen.Height - 600) div 3, Img.Width, Img.Height,
|
---|
55 | Img.Canvas, 0, 0);
|
---|
56 | end;
|
---|
57 |
|
---|
58 | procedure TBackground.FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
59 | begin
|
---|
60 | end;
|
---|
61 |
|
---|
62 | procedure TBackground.UpdateInterface;
|
---|
63 | var
|
---|
64 | FileName: string;
|
---|
65 | begin
|
---|
66 | if FullScreen then begin
|
---|
67 | WindowState := wsFullScreen;
|
---|
68 | if not Assigned(Img) then begin
|
---|
69 | FileName := GetGraphicsDir + DirectorySeparator + 'Background.png';
|
---|
70 | if FileExists(FileName) then begin
|
---|
71 | Img := TBitmap.Create;
|
---|
72 | LoadGraphicFile(Img, FileName);
|
---|
73 | Repaint;
|
---|
74 | end;
|
---|
75 | end;
|
---|
76 | end else begin
|
---|
77 | if WindowState <> wsMaximized then begin
|
---|
78 | WindowState := wsNormal;
|
---|
79 | WindowState := wsFullScreen;
|
---|
80 | end;
|
---|
81 | WindowState := wsNormal;
|
---|
82 | BoundsRect := Bounds(StartDlg.Left - 8, StartDlg.Top - 8,
|
---|
83 | StartDlg.Width + 16, StartDlg.Height + 16);
|
---|
84 | end;
|
---|
85 | end;
|
---|
86 |
|
---|
87 | end.
|
---|