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 var
S: String; S: String;
ASize: LongInt; ASize: LongInt;
ASize1: Integer; ASize1, PP: Integer;
begin begin
PP:=0;
Result := inherited DoReadString(Section, Ident, DefaultValue); Result := inherited DoReadString(Section, Ident, DefaultValue);
{$IfNDef FIX_WIDTH_WIDE_STRING96} {$IfNDef FIX_WIDTH_WIDE_STRING96}
S:=UpperCase(Ident); 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 begin
if Assigned(Screen) then if Assigned(Screen) then
begin begin
@ -125,8 +126,15 @@ begin
begin begin
//ASize1 := MulDiv(ASize, Screen.PixelsPerInch, 96); //ASize1 := MulDiv(ASize, Screen.PixelsPerInch, 96);
if Screen.PixelsPerInch <> 0 then if Screen.PixelsPerInch <> 0 then
ASize1 := MulDiv(ASize, 96, Screen.PixelsPerInch); begin
Result := IntToStr(ASize1); 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; end;
end; end;

View File

@ -3784,6 +3784,7 @@ var
i: integer; i: integer;
S, S1: string; S, S1: string;
C: TRxColumn; C: TRxColumn;
SF: TCaption;
begin begin
S := Owner.Name + '.' + Name; S := Owner.Name + '.' + Name;
FPropertyStorageLink.Storage.WriteInteger(S + sVersion, FVersion); FPropertyStorageLink.Storage.WriteInteger(S + sVersion, FVersion);
@ -3793,8 +3794,8 @@ begin
begin begin
S1 := S + IntToStr(i); S1 := S + IntToStr(i);
C := TRxColumn(Columns[i]); C := TRxColumn(Columns[i]);
FPropertyStorageLink.Storage.WriteString(S1 + sCaption, SF:=StrToHexText(C.Title.Caption);
StrToHexText(C.Title.Caption)); FPropertyStorageLink.Storage.WriteString(S1 + sCaption, SF);
//FPropertyStorageLink.Storage.WriteInteger(S1 + sWidth, C.Width); //FPropertyStorageLink.Storage.WriteInteger(S1 + sWidth, C.Width);
FPropertyStorageLink.Storage.WriteInteger(S1 + sWidth, C.StoredWidth); FPropertyStorageLink.Storage.WriteInteger(S1 + sWidth, C.StoredWidth);
FPropertyStorageLink.Storage.WriteInteger(S1 + sIndex, C.Index); FPropertyStorageLink.Storage.WriteInteger(S1 + sIndex, C.Index);
@ -3817,7 +3818,7 @@ end;
procedure TRxDBGrid.OnIniLoad(Sender: TObject); procedure TRxDBGrid.OnIniLoad(Sender: TObject);
var var
i, ACount: integer; i, ACount: integer;
S, S1, ColumName: string; S, S1, ColumName, SF: string;
C: TRxColumn; C: TRxColumn;
begin begin
@ -3831,8 +3832,8 @@ begin
for i := 0 to ACount - 1 do for i := 0 to ACount - 1 do
begin begin
S1 := S + IntToStr(i); S1 := S + IntToStr(i);
ColumName := HexTextToStr(FPropertyStorageLink.Storage.ReadString(S1 + SF:=FPropertyStorageLink.Storage.ReadString(S1 + sCaption, '');
sCaption, '')); ColumName := HexTextToStr(SF);
if ColumName <> '' then if ColumName <> '' then
begin begin
C := ColumnByCaption(ColumName); C := ColumnByCaption(ColumName);

View File

@ -259,7 +259,7 @@ const
sCount = '.Count'; sCount = '.Count';
sVisible = '.Visible'; sVisible = '.Visible';
sItem = '.Item'; sItem = '.Item';
sWidth = '.Width'; sWidth = '_Width';
// sTop = '.Top'; // sTop = '.Top';
sVersion = '.Version'; sVersion = '.Version';
sVersion2 = '.Version2'; sVersion2 = '.Version2';