码迷,mamicode.com
首页 > 其他好文 > 详细

去掉RM报表的页面边距提示

时间:2016-04-23 19:51:55      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:

TRMVirtualPreview.DlgPageSetup

procedure TRMVirtualPreview.DlgPageSetup;
var
  tmpForm: TRMPageSetupForm;
  liEndPage: TRMEndPage;
  lPage: TRMCustomPage;
  i: Integer;
  lPageWidth, lhRgn, lPageSize: Integer;
  lOldIndex: Integer;
begin
  if FPrepareReportFlag or (GetEndPages = nil) then Exit;

  liEndPage := TRMEndPages(GetEndPages)[Self.CurPage - 1];
  if liEndPage = nil then Exit;

  lOldIndex := RMPrinter.PrinterIndex;
  tmpForm := TRMPageSetupForm.Create(nil);
  try
    tmpForm.CurReport := TRMReport(Report);
    tmpForm.CurPrinter := TRMReport(Report).ReportPrinter;
    with liEndPage do
    begin
      tmpForm.PageSetting.PrinterName := RMPrinters.Printers[RMPrinter.PrinterIndex];
      tmpForm.PageSetting.Title := TRMReport(Report).ReportInfo.Title;
      tmpForm.PageSetting.DoublePass := TRMReport(Report).DoublePass;
      tmpForm.PageSetting.PrintBackGroundPicture := TRMReport(Report).PrintbackgroundPicture;
      tmpForm.PageSetting.ColorPrint := TRMReport(Report).ColorPrint;
      tmpForm.PageSetting.MarginLeft := RMFromMMThousandths(mmMarginLeft, rmutMillimeters);
      tmpForm.PageSetting.MarginTop := RMFromMMThousandths(mmMarginTop, rmutMillimeters);
      tmpForm.PageSetting.MarginRight := RMFromMMThousandths(mmMarginRight, rmutMillimeters);
      tmpForm.PageSetting.MarginBottom := RMFromMMThousandths(mmMarginBottom, rmutMillimeters);
      tmpForm.PageSetting.PageOr := PageOrientation;
      tmpForm.PageSetting.PageBin := PageBin;
      tmpForm.PageSetting.PageSize := PageSize;
      tmpForm.PageSetting.PageWidth := PageWidth;
      tmpForm.PageSetting.PageHeight := PageHeight;
      tmpForm.PageSetting.UnlimitedHeight := True;
      if tmpForm.PreviewPageSetup then//这里
      begin




TRMPageSetupForm.FormCloseQuery

procedure TRMPageSetupForm.FormCloseQuery(Sender: TObject;
  var CanClose: Boolean);
var
  liLeft, liTop, liRight, liBottom: Double;
  liPrnInfo: TRMPageInfo;

  function dm(pxls: integer; mmInInch: integer): Double;
  begin
    Result := Round((pxls / RMInchPerMM / mmInInch) * 10) / 10;
  end;

begin
  Exit;//这里 退出 
if ModalResult = mrOK then
  begin
    try
      FCurPrinter{RMPrinter}.PrinterIndex := cmbPrinterNames.ItemIndex;
      FCurPrinter{RMPrinter}.SetPrinterInfo(FPageSetting.PageSize, FPageSetting.PageWidth, FPageSetting.PageHeight,
        FPageSetting.PageBin, FPageSetting.PageOr, False);
      FCurPrinter{RMPrinter}.FillPrinterInfo(liPrnInfo);

      liLeft := dm(FCurPrinter{RMPrinter}.PageGutters.Left, FCurPrinter{RMPrinter}.PixelsPerInch.X);
      liTop := dm(RMPrinter.PageGutters.Top, FCurPrinter{RMPrinter}.PixelsPerInch.Y);
      liRight := dm(FCurPrinter{RMPrinter}.PageGutters.Right, FCurPrinter{RMPrinter}.PixelsPerInch.X);
      liBottom := dm(FCurPrinter{RMPrinter}.PageGutters.Bottom, FCurPrinter{RMPrinter}.PixelsPerInch.Y);

      if (FPageSetting.MarginLeft < liLeft) or (FPageSetting.MarginTop < liTop) or
        (FPageSetting.MarginRight < liRight) or (FPageSetting.MarginBottom < liBottom) then
      begin
        if ((FPageSetting.MarginLeft - liLeft) < 0.01) or ((FPageSetting.MarginTop - liTop) < 0.01) or
          ((FPageSetting.MarginRight - liRight) < 0.01) or ((FPageSetting.MarginBottom - liBottom) < 0.01) then
        begin
          if Application.MessageBox(PChar(RMLoadStr(rmRes + 213)), PChar(RMLoadStr(SWarning)),
            MB_ICONEXCLAMATION + MB_YESNO) = IDYES then
          begin
            if FPageSetting.MarginLeft < liLeft then
              FPageSetting.MarginLeft := liLeft + 2.5;
            if FPageSetting.MarginTop < liTop then
              FPageSetting.MarginTop := liTop + 2.5;
            if FPageSetting.MarginRight < liRight then
              FPageSetting.MarginRight := liRight + 2.5;
            if FPageSetting.MarginBottom < liBottom then
              FPageSetting.MarginBottom := liBottom + 2.5;
          end;
        end;
      end;
    except
    end;
  end;
end;

 

去掉RM报表的页面边距提示

标签:

原文地址:http://www.cnblogs.com/CodeGear/p/5425203.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!