RxFPC:TRxIniPropStorage - fix restore width and height property on different designtime and runtime PPI

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8939 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2023-10-09 07:39:41 +00:00
parent 2871daa7c1
commit 966da9ab85
3 changed files with 19 additions and 10 deletions

View File

@ -111,12 +111,13 @@ function TRxIniPropStorage.DoReadString(const Section, Ident,
var
S: String;
ASize: LongInt;
ASize1: Integer;
ASize1, PP: Integer;
begin
PP:=0;
Result := inherited DoReadString(Section, Ident, DefaultValue);
{$IfNDef FIX_WIDTH_WIDE_STRING96}
S:=UpperCase(Ident);
if (Pos('WIDTH', S) > 0) or (Pos('HEIGHT', S) > 0) then
if (Pos('_WIDTH', S) > 0) or (Pos('_HEIGHT', S) > 0) then
begin
if Assigned(Screen) then
begin
@ -125,8 +126,15 @@ begin
begin
//ASize1 := MulDiv(ASize, Screen.PixelsPerInch, 96);
if Screen.PixelsPerInch <> 0 then
ASize1 := MulDiv(ASize, 96, Screen.PixelsPerInch);
Result := IntToStr(ASize1);
begin
if Owner is TForm then
PP:=TForm(Owner).DesignTimePPI;
if PP>0 then
begin
ASize1 := MulDiv(ASize, PP, Screen.PixelsPerInch);
Result := IntToStr(ASize1);
end;
end;
end;
end;
end;