Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created July 24, 2015 09:39
Show Gist options
  • Save bjoerntx/8b7f5d6e2c521170b103 to your computer and use it in GitHub Desktop.
Save bjoerntx/8b7f5d6e2c521170b103 to your computer and use it in GitHub Desktop.
/*------------------------------------------------------
** 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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment