You've already forked lazarus-ccr
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:
@ -1,10 +1,10 @@
|
|||||||
object MainForm: TMainForm
|
object MainForm: TMainForm
|
||||||
Left = 331
|
Left = 331
|
||||||
Height = 491
|
Height = 485
|
||||||
Top = 127
|
Top = 127
|
||||||
Width = 651
|
Width = 651
|
||||||
Caption = 'Multi-Language Demonstration of TGridPrinter'
|
Caption = 'Multi-Language Demonstration of TGridPrinter'
|
||||||
ClientHeight = 491
|
ClientHeight = 485
|
||||||
ClientWidth = 651
|
ClientWidth = 651
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
LCLVersion = '2.3.0.0'
|
LCLVersion = '2.3.0.0'
|
||||||
@ -16,7 +16,7 @@ object MainForm: TMainForm
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = btnPrint
|
AnchorSideBottom.Control = btnPrint
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 411
|
Height = 405
|
||||||
Top = 39
|
Top = 39
|
||||||
Width = 635
|
Width = 635
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
@ -32,7 +32,7 @@ object MainForm: TMainForm
|
|||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 458
|
Top = 452
|
||||||
Width = 60
|
Width = 60
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
@ -47,7 +47,7 @@ object MainForm: TMainForm
|
|||||||
AnchorSideTop.Control = btnPrint
|
AnchorSideTop.Control = btnPrint
|
||||||
Left = 264
|
Left = 264
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 458
|
Top = 452
|
||||||
Width = 76
|
Width = 76
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Left = 24
|
BorderSpacing.Left = 24
|
||||||
@ -62,7 +62,7 @@ object MainForm: TMainForm
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 76
|
Left = 76
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 459
|
Top = 453
|
||||||
Width = 164
|
Width = 164
|
||||||
DropDownCount = 24
|
DropDownCount = 24
|
||||||
ItemHeight = 15
|
ItemHeight = 15
|
||||||
@ -84,7 +84,7 @@ object MainForm: TMainForm
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 348
|
Left = 348
|
||||||
Height = 22
|
Height = 22
|
||||||
Top = 459
|
Top = 453
|
||||||
Width = 295
|
Width = 295
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Around = 8
|
BorderSpacing.Around = 8
|
||||||
@ -155,9 +155,10 @@ object MainForm: TMainForm
|
|||||||
Top = 96
|
Top = 96
|
||||||
end
|
end
|
||||||
object GridPrintPreviewDialog1: TGridPrintPreviewDialog
|
object GridPrintPreviewDialog1: TGridPrintPreviewDialog
|
||||||
FormParams.Width = 840
|
FormParams.Width = 640
|
||||||
FormParams.Height = 800
|
FormParams.Height = 800
|
||||||
FormParams.Position = poDesigned
|
FormParams.Position = poDesigned
|
||||||
|
FormParams.PixelsPerInch = 96
|
||||||
GridPrinter = GridPrinter1
|
GridPrinter = GridPrinter1
|
||||||
Zoom = 199
|
Zoom = 199
|
||||||
ZoomMode = zmFitHeight
|
ZoomMode = zmFitHeight
|
||||||
|
@ -17,7 +17,14 @@ type
|
|||||||
FTop: Integer;
|
FTop: Integer;
|
||||||
FWidth: Integer;
|
FWidth: Integer;
|
||||||
FHeight: Integer;
|
FHeight: Integer;
|
||||||
|
FPixelsPerInch: Integer;
|
||||||
FPosition: TPosition;
|
FPosition: TPosition;
|
||||||
|
private
|
||||||
|
procedure ReadPPI(Reader: TReader);
|
||||||
|
procedure WritePPI(Writer: TWriter);
|
||||||
|
protected
|
||||||
|
procedure AdjustSize;
|
||||||
|
procedure DefineProperties(Filer: TFiler); override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TGridPrintPreviewDialog);
|
constructor Create(AOwner: TGridPrintPreviewDialog);
|
||||||
published
|
published
|
||||||
@ -36,6 +43,7 @@ type
|
|||||||
FZoom: Integer;
|
FZoom: Integer;
|
||||||
FZoomMode: TGridPrintPreviewZoomMode;
|
FZoomMode: TGridPrintPreviewZoomMode;
|
||||||
protected
|
protected
|
||||||
|
procedure Loaded; override;
|
||||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
@ -54,7 +62,7 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Controls, LCLIntf, LCLType;
|
Graphics, Controls, LCLIntf, LCLType;
|
||||||
|
|
||||||
{ TGridPrintPreviewFormParams }
|
{ TGridPrintPreviewFormParams }
|
||||||
|
|
||||||
@ -65,6 +73,32 @@ begin
|
|||||||
FWidth := 800;
|
FWidth := 800;
|
||||||
FHeight := 600;
|
FHeight := 600;
|
||||||
FPosition := poMainFormCenter;
|
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;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -126,6 +160,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TGridPrintPreviewDialog.Loaded;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
FFormParams.AdjustSize;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TGridPrintPreviewDialog.Notification(AComponent: TComponent;
|
procedure TGridPrintPreviewDialog.Notification(AComponent: TComponent;
|
||||||
Operation: TOperation);
|
Operation: TOperation);
|
||||||
begin
|
begin
|
||||||
|
Reference in New Issue
Block a user