Ignore:
Timestamp:
May 9, 2020, 4:02:07 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved HighDPI branch. Imported new changes from trunk branch.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Back.pas

    r193 r210  
    55
    66uses
    7   LCLIntf, LCLType, SysUtils, Classes, Graphics, Forms, Controls, UDpiControls;
     7  UDpiControls, LCLIntf, LCLType, SysUtils, Classes, Graphics, Forms, Controls;
    88
    99type
     
    1111  { TBackground }
    1212
    13   TBackground = class(TForm)
     13  TBackground = class(TDpiForm)
    1414    procedure FormDestroy(Sender: TObject);
    1515    procedure FormPaint(Sender: TObject);
     
    1919  private
    2020    Img: TDpiBitmap;
     21  public
     22    procedure UpdateInterface;
    2123  end;
    2224
     
    3739
    3840procedure 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;
    3963var
    4064  FileName: string;
    4165begin
    4266  if FullScreen then begin
     67    WindowState := wsMaximized;
    4368    if not Assigned(Img) then begin
    44       FileName := HomeDir + 'Graphics' + DirectorySeparator + 'Background.png';
     69      FileName := GetGraphicsDir + DirectorySeparator + 'Background.png';
    4570      if FileExists(FileName) then begin
    4671        Img := TDpiBitmap.Create;
     
    5782end;
    5883
    59 procedure TBackground.FormDestroy(Sender: TObject);
    60 begin
    61   if Assigned(Img) then FreeAndNil(Img);
    62 end;
    63 
    64 procedure TBackground.FormPaint(Sender: TObject);
    65 begin
    66   if Assigned(Img) then
    67     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 begin
    74 end;
    75 
    7684end.
Note: See TracChangeset for help on using the changeset viewer.