Пример #1
0
        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);
        }
Пример #2
0
        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;
            }
        }
Пример #3
0
        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);
        }