private int GetAcumPageHeight(int pageNo) { if (pageNo < 1 || FirstPageExportInfo == null) { return(0); } int AcumHeight = 0; int AcumPages = 0; int SheetCount = FirstPageExportInfo.SheetCount; for (int i = 1; i <= SheetCount; i++) { TOneImgExportInfo SheetInfo = FirstPageExportInfo.Sheet(i); if (SheetInfo == null) { continue; } int SheetPages = SheetInfo.TotalPages; int OneSheetHeight = ((int)Math.Round(SheetInfo.PageBounds.Height * Zoom) + RealYSep); int SheetHeight = SheetPages * OneSheetHeight; if (pageNo <= AcumPages + SheetPages) { return(AcumHeight + (pageNo - AcumPages) * OneSheetHeight); } AcumHeight += SheetHeight; AcumPages += SheetPages; } return(AcumHeight); }
private void GetVirtualPageCoords(int Page, out int Height, out int Width) { Height = 0; Width = 0; if (Page < 1 || FirstPageExportInfo == null) { return; } int AcumPages = 0; int SheetCount = FirstPageExportInfo.SheetCount; for (int i = 1; i <= SheetCount; i++) { TOneImgExportInfo SheetInfo = FirstPageExportInfo.Sheet(i); if (SheetInfo == null) { continue; } int SheetPages = SheetInfo.TotalPages; if (Page <= AcumPages + SheetPages) { Height = ((int)Math.Round(SheetInfo.PageBounds.Height * Zoom)); Width = ((int)Math.Round(SheetInfo.PageBounds.Width * Zoom)); return; } AcumPages += SheetPages; } }
private int GetPageNo(int height) { if (height < 0 || FirstPageExportInfo == null) { return(1); } int AcumHeight = 0; int AcumPages = 0; int SheetCount = FirstPageExportInfo.SheetCount; for (int i = 1; i <= SheetCount; i++) { TOneImgExportInfo SheetInfo = FirstPageExportInfo.Sheet(i); if (SheetInfo == null) { continue; } int SheetPages = SheetInfo.TotalPages; int OneSheetHeight = ((int)Math.Round(SheetInfo.PageBounds.Height * Zoom) + RealYSep); int SheetHeight = SheetPages * OneSheetHeight; if (AcumHeight + SheetHeight > height) { //Found the correct sheet. int RealHeight = height - AcumHeight; return(1 + AcumPages + RealHeight / OneSheetHeight); } AcumHeight += SheetHeight; AcumPages += SheetPages; } return(FirstPageExportInfo.TotalPages); }