source: branches/highdpi/Back.pas@ 210

Last change on this file since 210 was 210, checked in by chronos, 19 months ago
  • Modified: Improved HighDPI branch. Imported new changes from trunk branch.
File size: 1.7 KB
Line 
1{$INCLUDE Switches.inc}
2unit Back;
3
4interface
5
6uses
7 UDpiControls, LCLIntf, LCLType, SysUtils, Classes, Graphics, Forms, Controls;
8
9type
10
11 { TBackground }
12
13 TBackground = class(TDpiForm)
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: TDpiBitmap;
21 public
22 procedure UpdateInterface;
23 end;
24
25var
26 Background: TBackground;
27
28implementation
29
30uses
31 Directories, ScreenTools, Start;
32
33{$R *.lfm}
34
35procedure TBackground.FormCreate(Sender: TObject);
36begin
37 Img := nil;
38end;
39
40procedure TBackground.FormShow(Sender: TObject);
41begin
42 UpdateInterface;
43end;
44
45procedure TBackground.FormDestroy(Sender: TObject);
46begin
47 if Assigned(Img) then FreeAndNil(Img);
48end;
49
50procedure TBackground.FormPaint(Sender: TObject);
51begin
52 if Assigned(Img) then
53 DpiBitCanvas(Canvas, DpiScreen.Width - Img.Width - (DpiScreen.Width - 800) *
54 3 div 8, (DpiScreen.Height - 600) div 3, Img.Width, Img.Height,
55 Img.Canvas, 0, 0);
56end;
57
58procedure TBackground.FormClose(Sender: TObject; var Action: TCloseAction);
59begin
60end;
61
62procedure TBackground.UpdateInterface;
63var
64 FileName: string;
65begin
66 if FullScreen then begin
67 WindowState := wsMaximized;
68 if not Assigned(Img) then begin
69 FileName := GetGraphicsDir + DirectorySeparator + 'Background.png';
70 if FileExists(FileName) then begin
71 Img := TDpiBitmap.Create;
72 LoadGraphicFile(img, FileName);
73 end;
74 end;
75 end else begin
76 WindowState := wsNormal;
77 Width := StartDlg.Width + 16;
78 Height := StartDlg.Height + 16;
79 Left := StartDlg.Left - 8;
80 Top := StartDlg.Top - 8;
81 end;
82end;
83
84end.
Note: See TracBrowser for help on using the repository browser.