source: branches/delphi/Back.pas

Last change on this file was 6, checked in by chronos, 7 years ago
  • Modified: Formated all project source files using Delphi formatter as original indentation and other formatting was really bad.
File size: 1.5 KB
Line 
1{$INCLUDE switches}
2unit Back;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Forms;
8
9type
10 TBackground = class(TForm)
11 procedure FormPaint(Sender: TObject);
12 procedure FormShow(Sender: TObject);
13 procedure FormCreate(Sender: TObject);
14 procedure FormClose(Sender: TObject; var Action: TCloseAction);
15 private
16 img: TBitmap;
17 end;
18
19var
20 Background: TBackground;
21
22implementation
23
24uses
25 Directories, ScreenTools, Start;
26
27{$R *.DFM}
28
29procedure TBackground.FormCreate(Sender: TObject);
30begin
31 img := nil;
32end;
33
34procedure TBackground.FormShow(Sender: TObject);
35begin
36 img := nil;
37 if FullScreen then
38 begin
39 if FileExists(HomeDir + 'Graphics\Background.bmp') or
40 FileExists(HomeDir + 'Graphics\Background.png') then
41 begin
42 img := TBitmap.Create;
43 LoadGraphicFile(img, HomeDir + 'Graphics\Background');
44 end
45 end
46 else
47 begin
48 WindowState := wsNormal;
49 Width := StartDlg.Width + 16;
50 Height := StartDlg.Height + 16;
51 Left := StartDlg.Left - 8;
52 Top := StartDlg.Top - 8;
53 end
54end;
55
56procedure TBackground.FormPaint(Sender: TObject);
57begin
58 if img <> nil then
59 BitBlt(Canvas.Handle, Screen.Width - img.Width - (Screen.Width - 800) *
60 3 div 8, (Screen.Height - 600) div 3, img.Width, img.Height,
61 img.Canvas.Handle, 0, 0, SRCCOPY);
62end;
63
64procedure TBackground.FormClose(Sender: TObject; var Action: TCloseAction);
65begin
66 if img <> nil then
67 begin
68 img.Free;
69 img := nil
70 end;
71end;
72
73end.
Note: See TracBrowser for help on using the repository browser.