Changeset 246 for branches/highdpi/LocalPlayer/TechTree.pas
- Timestamp:
- May 21, 2020, 8:17:38 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/TechTree.pas
r210 r246 9 9 10 10 type 11 12 { TTechTreeDlg } 13 11 14 TTechTreeDlg = class(TDrawDlg) 12 15 CloseBtn: TButtonB; 13 16 procedure FormCreate(Sender: TObject); 17 procedure FormDestroy(Sender: TObject); 14 18 procedure FormPaint(Sender: TObject); 15 19 procedure FormShow(Sender: TObject); … … 24 28 xOffset, yOffset, xDown, yDown: Integer; 25 29 Image: TDpiBitmap; 26 dragging: boolean;30 Dragging: Boolean; 27 31 end; 28 32 … … 72 76 InitButtons; 73 77 Image := nil; 78 end; 79 80 procedure TTechTreeDlg.FormDestroy(Sender: TObject); 81 begin 82 FreeAndNil(Image); 74 83 end; 75 84 … … 121 130 X, Y, ad: Integer; 122 131 s: string; 132 NewWidth: Integer; 133 NewHeight: Integer; 123 134 const 124 135 TransparentColor = $7F007F; … … 164 175 165 176 // 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); 172 182 CloseBtn.Left := width - CloseBtn.width - BlackBorder - 8; 173 183 CloseBtn.Top := BlackBorder + 8; 174 xOffset := (ClientWidth - Image. width + LeftBorder - RightBorder) div 2 -184 xOffset := (ClientWidth - Image.Width + LeftBorder - RightBorder) div 2 - 175 185 BlackBorder; 176 yOffset := ClientHeight - 2 * BlackBorder - Image. height - BottomBorder;186 yOffset := ClientHeight - 2 * BlackBorder - Image.Height - BottomBorder; 177 187 end; 178 188
Note:
See TracChangeset
for help on using the changeset viewer.