mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-16 23:49:28 +02:00
lcl: forms: highDPI: don't read TCustomForm.PixelsPerInch from Screen but use rather the value from design-time and update it on scale.
git-svn-id: trunk@53512 -
This commit is contained in:
parent
2d8600e1fd
commit
337925d861
@ -456,7 +456,6 @@ type
|
||||
function GetClientHandle: HWND;
|
||||
function GetEffectiveShowInTaskBar: TShowInTaskBar;
|
||||
function GetMonitor: TMonitor;
|
||||
function GetPixelsPerInch: Longint;
|
||||
function IsAutoScrollStored: Boolean;
|
||||
function IsForm: Boolean;
|
||||
function IsIconStored: Boolean;
|
||||
@ -693,7 +692,7 @@ type
|
||||
property OnWindowStateChange: TNotifyEvent
|
||||
read FOnWindowStateChange write FOnWindowStateChange;
|
||||
property ParentFont default False;
|
||||
property PixelsPerInch: Longint read GetPixelsPerInch write FPixelsPerInch stored False;
|
||||
property PixelsPerInch: Longint read FPixelsPerInch write FPixelsPerInch stored False;
|
||||
property Position: TPosition read FPosition write SetPosition default poDesigned;
|
||||
property RestoredLeft: integer read FRestoredLeft;
|
||||
property RestoredTop: integer read FRestoredTop;
|
||||
|
@ -159,9 +159,9 @@ begin
|
||||
EndFormUpdate; // the BeginFormUpdate is in CreateNew
|
||||
inherited AfterConstruction;
|
||||
|
||||
if Scaled and (Screen.PixelsPerInch<>DesignTimeDPI) then
|
||||
if Scaled and (Screen.PixelsPerInch<>FPixelsPerInch) then
|
||||
begin
|
||||
ScaleBy(Screen.PixelsPerInch, DesignTimeDPI);
|
||||
ScaleBy(Screen.PixelsPerInch, PixelsPerInch);
|
||||
FPixelsPerInch := Screen.PixelsPerInch;
|
||||
end;
|
||||
end;
|
||||
@ -2333,35 +2333,6 @@ begin
|
||||
Result := IsForm and (Icon <> nil);
|
||||
end;
|
||||
|
||||
function TCustomForm.GetPixelsPerInch: Longint;
|
||||
var
|
||||
ParentForm: TCustomForm;
|
||||
DC: HDC;
|
||||
begin
|
||||
if FPixelsPerInch = 0 then
|
||||
begin
|
||||
if Assigned(Parent) then
|
||||
begin
|
||||
ParentForm := GetParentForm(Self);
|
||||
if Assigned(ParentForm) then
|
||||
FPixelsPerInch := ParentForm.PixelsPerInch;
|
||||
end;
|
||||
|
||||
if FPixelsPerInch <= 0 then
|
||||
begin
|
||||
if HandleAllocated then
|
||||
begin
|
||||
DC := GetDC(Handle);
|
||||
FPixelsPerInch := GetDeviceCaps(DC, LOGPIXELSX);
|
||||
ReleaseDC(Handle, DC);
|
||||
end
|
||||
else
|
||||
FPixelsPerInch := Screen.PixelsPerInch;
|
||||
end;
|
||||
end;
|
||||
Result := FPixelsPerInch;
|
||||
end;
|
||||
|
||||
function TCustomForm.GetMonitor: TMonitor;
|
||||
begin
|
||||
Result := Screen.MonitorFromWindow(Handle, mdNearest);
|
||||
@ -2705,10 +2676,11 @@ begin
|
||||
if Control.CanFocus then SetActiveControl(Control);
|
||||
end;
|
||||
//DebugLn('TCustomForm.Loaded ',Name,':',ClassName,' ',FormUpdating,' ',fsCreating in FFormState,' ',Visible,' ',fsVisible in FormState);
|
||||
if fsVisible in FormState then
|
||||
Visible := True;
|
||||
if csDesigning in ComponentState then
|
||||
FDesignTimeDPI := Screen.PixelsPerInch;
|
||||
FPixelsPerInch := FDesignTimeDPI;
|
||||
if fsVisible in FormState then
|
||||
Visible := True;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user