Ignore:
Timestamp:
May 21, 2020, 8:17:38 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Update from trunk rev 245.
  • Modified: Vcl prefix/suffix changed to Native.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/LocalPlayer/TechTree.pas

    r210 r246  
    99
    1010type
     11
     12  { TTechTreeDlg }
     13
    1114  TTechTreeDlg = class(TDrawDlg)
    1215    CloseBtn: TButtonB;
    1316    procedure FormCreate(Sender: TObject);
     17    procedure FormDestroy(Sender: TObject);
    1418    procedure FormPaint(Sender: TObject);
    1519    procedure FormShow(Sender: TObject);
     
    2428    xOffset, yOffset, xDown, yDown: Integer;
    2529    Image: TDpiBitmap;
    26     dragging: boolean;
     30    Dragging: Boolean;
    2731  end;
    2832
     
    7276  InitButtons;
    7377  Image := nil;
     78end;
     79
     80procedure TTechTreeDlg.FormDestroy(Sender: TObject);
     81begin
     82  FreeAndNil(Image);
    7483end;
    7584
     
    121130  X, Y, ad: Integer;
    122131  s: string;
     132  NewWidth: Integer;
     133  NewHeight: Integer;
    123134const
    124135  TransparentColor = $7F007F;
     
    164175
    165176  // fit window to image, center image in window, center window to screen
    166   width := min(DpiScreen.width - 40, Image.width + LeftBorder + RightBorder + 2 *
    167     BlackBorder);
    168   height := min(DpiScreen.height - 40, Image.height + TopBorder + BottomBorder + 2
    169     * BlackBorder);
    170   Left := (DpiScreen.width - width) div 2;
    171   Top := (DpiScreen.height - height) div 2;
     177  NewWidth := Min(DpiScreen.Width - 40, Image.Width + LeftBorder + RightBorder + 2 * BlackBorder);
     178  NewHeight := Min(DpiScreen.Height - 40, Image.Height + TopBorder + BottomBorder + 2 * BlackBorder);
     179  BoundsRect := Bounds((DpiScreen.Width - NewWidth) div 2,
     180    (DpiScreen.Height - NewHeight) div 2,
     181    NewWidth, NewHeight);
    172182  CloseBtn.Left := width - CloseBtn.width - BlackBorder - 8;
    173183  CloseBtn.Top := BlackBorder + 8;
    174   xOffset := (ClientWidth - Image.width + LeftBorder - RightBorder) div 2 -
     184  xOffset := (ClientWidth - Image.Width + LeftBorder - RightBorder) div 2 -
    175185    BlackBorder;
    176   yOffset := ClientHeight - 2 * BlackBorder - Image.height - BottomBorder;
     186  yOffset := ClientHeight - 2 * BlackBorder - Image.Height - BottomBorder;
    177187end;
    178188
Note: See TracChangeset for help on using the changeset viewer.