Example #1
0
        // Position all the descriptions with the positioner.
        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);
        }
        // Position all the descriptions with the positioner.
        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;
        }