fastreport 自动缩小字体以填充

1.
procedure Memo8OnBeforePrint(Sender: TfrxComponent);
begin
  while ((TfrxMemoView(Sender).CalcHeight-TfrxMemoView(Sender).LineSpacing)-TfrxMemoView(Sender).Height>0) do
  begin
    TfrxMemoView(Sender).Font.Size := TfrxMemoView(Sender).Font.Size-5;
  end;
end;


2.
begin
     per:=1.4;
     xy:=[adoquery1."xy"];
     len:=length(xy);
     width:=memo1.width;
     fs:= Round(width  / len * per) ;
     memo1.font.size:=fs;
     memo1.memo :=xy;
     memo2.memo:= str(width);
end


增加字体调整模式
TfrxScaleFontSize = (sfsWidth, sfsHeight, sfsNone);
增加TfrxMemoView属性
property ScaleFontSize;
增加TfrxCustomMemoView属性
property ScaleFontSize: TfrxScaleFontSize read FScaleFontSize write FScaleFontSize default sfsNone;

procedure TfrxCustomMemoView.BeforePrint;
begin
  inherited;
  if not IsDataField then
    FTempMemo := FMemo.Text;

  case FScaleFontSize of
    sfsNone: ;

    sfsWidth:
      if not WordWrap and not AutoWidth then //按宽度调整时--自动换行时不可用 ;  自动宽度时不可用
        while (CalcWidth - Width > 0) do
          Font.Size := Font.Size - 1;

    sfsHeight:
      if (StretchMode = smDontStretch) then //伸展时不能按高度调整
        while ((CalcHeight - LineSpacing) - Height > 0) do
          Font.Size := Font.Size - 1;
  end;
end;
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值