GridPrinter: Fix LCLScaling for PreviewForm size parameters.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8619 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-11-13 13:20:17 +00:00
parent 1f2391e102
commit 323744eaff
2 changed files with 50 additions and 9 deletions

View File

@@ -17,7 +17,14 @@ type
FTop: Integer;
FWidth: Integer;
FHeight: Integer;
FPixelsPerInch: Integer;
FPosition: TPosition;
private
procedure ReadPPI(Reader: TReader);
procedure WritePPI(Writer: TWriter);
protected
procedure AdjustSize;
procedure DefineProperties(Filer: TFiler); override;
public
constructor Create(AOwner: TGridPrintPreviewDialog);
published
@@ -36,6 +43,7 @@ type
FZoom: Integer;
FZoomMode: TGridPrintPreviewZoomMode;
protected
procedure Loaded; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
public
constructor Create(AOwner: TComponent); override;
@@ -54,7 +62,7 @@ type
implementation
uses
Controls, LCLIntf, LCLType;
Graphics, Controls, LCLIntf, LCLType;
{ TGridPrintPreviewFormParams }
@@ -65,6 +73,32 @@ begin
FWidth := 800;
FHeight := 600;
FPosition := poMainFormCenter;
FPixelsPerInch := ScreenInfo.PixelsPerInchY;
end;
procedure TGridPrintPreviewFormParams.AdjustSize;
var
ppi: Integer;
begin
ppi := ScreenInfo.PixelsPerInchY;
Width := MulDiv(Width, ppi, FPixelsPerInch);
Height := MulDiv(Height, ppi, FPixelsPerInch);
end;
procedure TGridPrintPreviewFormParams.DefineProperties(Filer: TFiler);
begin
inherited DefineProperties(Filer);
Filer.DefineProperty('PixelsPerInch', @ReadPPI, @WritePPI, true);
end;
procedure TGridPrintPreviewFormParams.ReadPPI(Reader: TReader);
begin
FPixelsPerInch := Reader.ReadInteger;
end;
procedure TGridPrintPreviewFormParams.WritePPI(Writer: TWriter);
begin
Writer.WriteInteger(ScreenInfo.PixelsPerInchY);
end;
@@ -126,6 +160,12 @@ begin
end;
end;
procedure TGridPrintPreviewDialog.Loaded;
begin
inherited;
FFormParams.AdjustSize;
end;
procedure TGridPrintPreviewDialog.Notification(AComponent: TComponent;
Operation: TOperation);
begin