/*------------------------------------------------------ ** Constructor ** description: Initializes the private data fields **----------------------------------------------------*/ public MultipagePrintDocument(TXTextControl.TextControl textControl, PagePerSheet pagesPerSheet, bool drawPageBorders) { if (textControl == null) throw new ArgumentNullException( "An object of type TXTextControl.TextControl must be defined."); m_textControl = textControl; m_pagesPerSheet = pagesPerSheet; m_drawPageBorders = drawPageBorders; }
/*------------------------------------------------------ ** GetThumbnailValuePair ** description: Returns a ThumbnailGrid value pair based ** on the enum value 'PagePerSheet' ** ** parameters: enum PagePerSheet pagesPerSheet **----------------------------------------------------*/ private ThumbnailGrid GetThumbnailValuePair(PagePerSheet pagesPerSheet) { ThumbnailGrid szColRowSize; // return the number of rows and columns as a ThumbnailGrid value pair switch (pagesPerSheet) { case PagePerSheet.EightByFour: szColRowSize = new ThumbnailGrid(8, 4); break; case PagePerSheet.FourByFour: szColRowSize = new ThumbnailGrid(4, 4); break; case PagePerSheet.ThreeByThree: szColRowSize = new ThumbnailGrid(3, 3); break; case PagePerSheet.FourByTwo: szColRowSize = new ThumbnailGrid(4, 2); break; case PagePerSheet.ThreeByTwo: szColRowSize = new ThumbnailGrid(3, 2); break; case PagePerSheet.TwoByTwo: szColRowSize = new ThumbnailGrid(2, 2); break; case PagePerSheet.TwoByOne: szColRowSize = new ThumbnailGrid(2, 1); break; default: szColRowSize = new ThumbnailGrid(1, 1); break; } // if landscape, switch the values if (m_paperSize.Width < m_paperSize.Height) return new ThumbnailGrid(szColRowSize.Rows, szColRowSize.Columns); return szColRowSize; }