tvplanit: Fix scaling when printing contacts to printer.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8521 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-10-07 17:45:28 +00:00
parent 8210ffc6af
commit 469cf2e19e
4 changed files with 169 additions and 122 deletions

View File

@@ -117,6 +117,7 @@ type
FExternalPopup: TPopupMenu;
FHintMode: TVpHintMode;
FPendingDatastore: TVpCustomDatastore;
// FRowHeight: Integer;
FTextMargin: Integer;
procedure InternalSetDatastore(const Value: TVpCustomDatastore);
procedure SetPopupMenu(AValue: TPopupMenu);
@@ -157,7 +158,6 @@ type
cgClickPoint : TPoint;
cgClickTimer : TTimer;
cgLoaded : Boolean;
cgRowHeight : Integer;
cgInPlaceEditor : TVpCGInPlaceEdit;
cgCreatingEditor : Boolean;
cgPainting : Boolean;
@@ -180,7 +180,7 @@ type
procedure SetDataStore(const Value: TVpCustomDataStore); override;
{ internal methods }
procedure cgCalcRowHeight;
// procedure cgCalcRowHeight;
procedure cgEditInPlace(Sender: TObject);
procedure cgHookUp;
function ContactIsVisible(AIndex: Integer): Boolean;
@@ -279,6 +279,9 @@ type
property ActiveContact: TVpContact read FActiveContact;
property ContactIndex: Integer read FContactIndex write SetContactIndex;
// Unscaled some dimensions
// property RowHeight: Integer read FRowHeight;
published
property Align;
property Anchors;
@@ -903,24 +906,38 @@ begin
Invalidate;
end;
end;
(*
{ Calculates row height based on the largest of the header font and the
standard client font, using a sample character string. }
procedure TVpContactGrid.cgCalcRowHeight;
var
SaveFont: TFont;
Temp: Integer;
//savedFont: TFont;
h: Integer;
begin
{ Calculates row height based on the largest of the RowHead's Minute font,
the standard client font, and a sample character string. }
SaveFont := Canvas.Font;
FRowHeight := GetCanvasTextHeight(Canvas, FContactHeadAttr.Font, TallShortChars);
h := GetCanvasTextHeight(Canvas, Font, TallShortChars);
if h > FRowHeight then
FRowHeight := h;
FRowHeight := FRowHeight + FTextMargin * 2;
{
savedFont := Canvas.Font;
Canvas.Font.Assign(FContactHeadAttr.Font);
cgRowHeight := Canvas.TextHeight(TallShortChars);
Canvas.Font.Assign(SaveFont);
Temp := Canvas.TextHeight(TallShortChars);
if Temp > cgRowHeight then
cgRowHeight := Temp;
cgRowHeight := cgRowHeight + TextMargin * 2;
Canvas.Font.Assign(SaveFont);
FRowHeight := Canvas.TextHeight(TallShortChars);
Canvas.Font.Assign(savedFont);
tmp := Canvas.TextHeight(TallShortChars);
if tmp > FRowHeight then
FRowHeight := tmp;
FRowHeight := FRowHeight + TextMargin * 2;
Canvas.Font.Assign(savedFont);
}
end;
*)
procedure TVpContactGrid.SetDrawingStyle(const Value: TVpDrawingStyle);
begin
@@ -1000,7 +1017,7 @@ end;
procedure TVpContactGrid.CreateWnd;
begin
inherited;
cgCalcRowHeight;
// cgCalcRowHeight;
SetHScrollPos;
end;