RichView RichEdit SRichViewEdit PageSize 页面快捷设置

95 篇文章 0 订阅
24 篇文章 2 订阅

RichView RichEdit SRichViewEdit PageSize 页面快捷设置

      建立一个RichView RichEdit SRichViewEdit PageSize 页面快捷设置界面:

  可以快速对RichView进行Page的参数,进行设置:

  例如竖页:

     切换横页:

     一键切换。

    按键代码: 

procedure TRichView_11_Frm.sButton7Click(Sender: TObject);
var sPage,sMargin:string;
begin
  sPage:=sComboBox1.text;
  sMargin:=sComboBox2.text;
// 切换 poPortrait  poLandscape
  if sRadioButton1.Checked
    then SetDBSRichViewEditPageSize(SRichViewEdit1,sPage,sMargin,poPortrait)      
    else SetDBSRichViewEditPageSize(SRichViewEdit1,sPage,sMargin,poLandscape);
  SRichViewEdit1.RichViewEdit.Format;
  SRichViewEdit1.RichViewEdit.SetFocus;
end;

     实现上述操作,关键是,要建立一个设置页面的函数:

procedure SetDBSRichViewEditPageSize(RV: TDBSRichViewEdit;sPage,sMargin:string;PrinterOrientation:TPrinterOrientation);
var iLong,iSort:Integer;
begin
  if sPage='A3' then
  begin
    RV.RichViewEdit.DocParameters.Units := rvuMillimeters;
//  TRVUnits = (rvuInches, rvuCentimeters, rvuMillimeters, rvuPicas, rvuPixels, rvuPoints);
    RV.PageProperty.Orientation:=PrinterOrientation;         // 页面方向    poPortrait  poLandscape
    iLong:=420;
    iSort:=297;
    if PrinterOrientation=poPortrait then
    begin
      RV.PageProperty.PageWidth := iSort;
      RV.PageProperty.PageHeight := iLong;
    end
    else begin
      RV.PageProperty.PageWidth := iLong;
      RV.PageProperty.PageHeight := iSort;
    end;
  end;

  if sPage='A4' then
  begin
    RV.RichViewEdit.DocParameters.Units := rvuMillimeters;
//  TRVUnits = (rvuInches, rvuCentimeters, rvuMillimeters, rvuPicas, rvuPixels, rvuPoints);
    RV.PageProperty.Orientation:=PrinterOrientation;         // 页面方向    poPortrait  poLandscape
    iLong:=297;
    iSort:=210;
    if PrinterOrientation=poPortrait then
    begin
      RV.PageProperty.PageWidth := iSort;
      RV.PageProperty.PageHeight := iLong;
    end
    else begin
      RV.PageProperty.PageWidth := iLong;
      RV.PageProperty.PageHeight := iSort;
    end;
  end;
  if sPage='A5' then
  begin
    RV.RichViewEdit.DocParameters.Units := rvuMillimeters;
//    RV.PageProperty :=RV.PagePropertyMain.PageProperty;
    RV.PageProperty.Orientation:=PrinterOrientation;   // 页面方向    poPortrait  poLandscape
    iLong:=210;
    iSort:=148;
    if PrinterOrientation=poPortrait then
    begin
      RV.PageProperty.PageWidth := iSort;
      RV.PageProperty.PageHeight := iLong;
    end
    else begin
      RV.PageProperty.PageWidth := iLong;
      RV.PageProperty.PageHeight := iSort;
    end;
  end;
  if sMargin='国际标准' then
  begin
    RV.PageProperty.TopMargin := 25.4;
    RV.PageProperty.BottomMargin := 25.4;
    RV.PageProperty.LeftMargin := 31.75;
    RV.PageProperty.RightMargin := 31.75;
    RV.PageProperty.HeaderY := 12.7;
    RV.PageProperty.FooterY := 12.7;
  end;
  if sMargin='标准1' then
  begin
    RV.PageProperty.TopMargin := 25.4;
    RV.PageProperty.BottomMargin := 25.4;
    RV.PageProperty.LeftMargin := 30;
    RV.PageProperty.RightMargin := 20;
    RV.PageProperty.HeaderY := 12.7;
    RV.PageProperty.FooterY := 12.7;
  end;
  if sMargin='标准2' then
  begin
    RV.PageProperty.TopMargin := 20;
    RV.PageProperty.BottomMargin := 20;
    RV.PageProperty.LeftMargin := 25;
    RV.PageProperty.RightMargin := 15;
    RV.PageProperty.HeaderY := 10;
    RV.PageProperty.FooterY := 10;
  end;
  if sMargin='标准3' then
  begin
    RV.PageProperty.TopMargin := 10;
    RV.PageProperty.BottomMargin := 10;
    RV.PageProperty.LeftMargin := 20;
    RV.PageProperty.RightMargin := 10;
    RV.PageProperty.HeaderY := 8;
    RV.PageProperty.FooterY := 8;
  end;
  if sMargin='最小边缘' then
  begin
    RV.PageProperty.TopMargin := 5;
    RV.PageProperty.BottomMargin := 5;
    RV.PageProperty.LeftMargin := 5;
    RV.PageProperty.RightMargin := 5;
    RV.PageProperty.HeaderY := 0;
    RV.PageProperty.FooterY := 0;
  end;
end;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值