PurplePen.RectanglePrinting.LayoutPages C# (CSharp) Method

LayoutPages() protected method

protected LayoutPages ( System.Drawing.Printing.PageSettings pageSettings, SizeF printArea ) : int
pageSettings System.Drawing.Printing.PageSettings
printArea System.Drawing.SizeF
return int
        protected override int LayoutPages(PageSettings pageSettings, SizeF printArea)
        {
            // Get the list of renderers for the descriptions we're printing.
            IPrintableRectangle[] rendererList = GetDescriptionList();

            // Position them with the DescriptionPositioner.
            positioner = new RectanglePositioner(printArea, boxSize / 0.254F, SPACING);

            if (countKind == PrintingCountKind.OneDescription) {
                positioner.LayoutMultipleDescriptions(rendererList);
            }
            else if (countKind == PrintingCountKind.OnePage) {
                foreach (DescriptionRenderer renderer in rendererList)
                    positioner.LayoutOneDescriptionPage(renderer);
            }
            else if (countKind == PrintingCountKind.DescriptionCount) {
                foreach (DescriptionRenderer renderer in rendererList) {
                    // renderer pages until we hit the number of selected controls.
                    int countDescriptions = 0;
                    while (countDescriptions < count) {
                        countDescriptions += positioner.LayoutOneDescriptionPage(renderer);
                    }
                }
            }
            else if (countKind == PrintingCountKind.CopyCount) {
                for (int copy = 0; copy < count; ++copy)
                    positioner.LayoutMultipleDescriptions(rendererList);
            }
            else {
                Debug.Fail("unknown countKind");
            }

            return positioner.PageCount;
        }