Changeset 210 for branches/highdpi/Back.pas
- Timestamp:
- May 9, 2020, 4:02:07 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Back.pas
r193 r210 5 5 6 6 uses 7 LCLIntf, LCLType, SysUtils, Classes, Graphics, Forms, Controls, UDpiControls;7 UDpiControls, LCLIntf, LCLType, SysUtils, Classes, Graphics, Forms, Controls; 8 8 9 9 type … … 11 11 { TBackground } 12 12 13 TBackground = class(T Form)13 TBackground = class(TDpiForm) 14 14 procedure FormDestroy(Sender: TObject); 15 15 procedure FormPaint(Sender: TObject); … … 19 19 private 20 20 Img: TDpiBitmap; 21 public 22 procedure UpdateInterface; 21 23 end; 22 24 … … 37 39 38 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 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); 56 end; 57 58 procedure TBackground.FormClose(Sender: TObject; var Action: TCloseAction); 59 begin 60 end; 61 62 procedure TBackground.UpdateInterface; 39 63 var 40 64 FileName: string; 41 65 begin 42 66 if FullScreen then begin 67 WindowState := wsMaximized; 43 68 if not Assigned(Img) then begin 44 FileName := HomeDir + 'Graphics'+ DirectorySeparator + 'Background.png';69 FileName := GetGraphicsDir + DirectorySeparator + 'Background.png'; 45 70 if FileExists(FileName) then begin 46 71 Img := TDpiBitmap.Create; … … 57 82 end; 58 83 59 procedure TBackground.FormDestroy(Sender: TObject);60 begin61 if Assigned(Img) then FreeAndNil(Img);62 end;63 64 procedure TBackground.FormPaint(Sender: TObject);65 begin66 if Assigned(Img) then67 DpiBitBlt(Canvas.Handle, DpiScreen.Width - Img.Width - (DpiScreen.Width - 800) *68 3 div 8, (DpiScreen.Height - 600) div 3, Img.Width, Img.Height,69 Img.Canvas.Handle, 0, 0, SRCCOPY);70 end;71 72 procedure TBackground.FormClose(Sender: TObject; var Action: TCloseAction);73 begin74 end;75 76 84 end.
Note:
See TracChangeset
for help on using the changeset viewer.