Enable Windows DPI awareness

This commit is contained in:
2026-05-24 16:29:13 +03:00
parent 8624116f0c
commit ffb735756e
3 changed files with 95 additions and 6 deletions
+8 -6
View File
@@ -923,6 +923,12 @@ end;
// Settings helpers
// ===========================================================================
function CurrentScreenDPI: Integer;
begin
Result := Screen.PixelsPerInch;
if Result <= 0 then Result := 96;
end;
procedure TMainForm.RestoreWindowBounds;
var
L, T, Wd, Ht, SavedDPI, CurDPI: Integer;
@@ -932,9 +938,7 @@ begin
FSettings.LoadWindowBounds(L, T, Wd, Ht, SavedDPI);
if (Wd > 400) and (Ht > 300) then
begin
CurDPI := PixelsPerInch;
if CurDPI <= 0 then CurDPI := Screen.PixelsPerInch;
if CurDPI <= 0 then CurDPI := 96;
CurDPI := CurrentScreenDPI;
if SavedDPI <= 0 then SavedDPI := CurDPI;
if SavedDPI <> CurDPI then
@@ -977,9 +981,7 @@ begin
end;
if (Wd <= 400) or (Ht <= 300) then Exit;
DPI := PixelsPerInch;
if DPI <= 0 then DPI := Screen.PixelsPerInch;
if DPI <= 0 then DPI := 96;
DPI := CurrentScreenDPI;
FSettings.SaveWindowBounds(L, T, Wd, Ht, DPI);
end;