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,11 +126,18 @@ begin
begin
//ASize1 := MulDiv(ASize, Screen.PixelsPerInch, 96);
if Screen.PixelsPerInch <> 0 then
ASize1 := MulDiv(ASize, 96, Screen.PixelsPerInch);
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;
{$EndIf}
end;

View File

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

View File

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