Changeset 97 for trunk


Ignore:
Timestamp:
Jan 23, 2017, 9:59:49 PM (7 years ago)
Author:
chronos
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Back.pas

    r86 r97  
    1818    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    1919  private
    20     img: TBitmap;
     20    Img: TBitmap;
    2121  end;
    2222
     
    3333procedure TBackground.FormCreate(Sender: TObject);
    3434begin
    35   img := nil;
     35  Img := nil;
    3636end;
    3737
    3838procedure TBackground.FormShow(Sender: TObject);
    3939begin
    40   img := nil;
     40  Img := nil;
    4141  if FullScreen then begin
    4242    if FileExists(HomeDir + 'Graphics' + DirectorySeparator + 'Background.png') then begin
    43       img := TBitmap.Create;
     43      Img := TBitmap.Create;
    4444      LoadGraphicFile(img, HomeDir + 'Graphics' + DirectorySeparator + 'Background.png');
    4545    end;
     
    5555procedure TBackground.FormDestroy(Sender: TObject);
    5656begin
    57   // TODO Why FormClose is not executed?
    58   if img <> nil then
    59     FreeAndNil(img);
     57  if Assigned(Img) then FreeAndNil(Img);
    6058end;
    6159
    6260procedure TBackground.FormPaint(Sender: TObject);
    6361begin
    64   if img <> nil then
    65     BitBlt(Canvas.Handle, Screen.Width - img.Width - (Screen.Width - 800) *
    66       3 div 8, (Screen.Height - 600) div 3, img.Width, img.Height,
    67       img.Canvas.Handle, 0, 0, SRCCOPY);
     62  if Assigned(Img) then
     63    BitBlt(Canvas.Handle, Screen.Width - Img.Width - (Screen.Width - 800) *
     64      3 div 8, (Screen.Height - 600) div 3, Img.Width, Img.Height,
     65      Img.Canvas.Handle, 0, 0, SRCCOPY);
    6866end;
    6967
    7068procedure TBackground.FormClose(Sender: TObject; var Action: TCloseAction);
    7169begin
    72   if img <> nil then begin
    73     img.Free;
    74     img := nil
    75   end;
    7670end;
    7771
Note: See TracChangeset for help on using the changeset viewer.