How to create a thumbnail viewer

UI, View
9/22/2015

This sample shows how you can create a thumbnail viewer for your PDF application and it builds on the SimpleViewer code sample. The ThumbnailsViewer class creates an interface from which you can easily get an overview of all the pdf pages in the document. In short, the ThumbnailsViewer has a LayoutManager which manages how the thumbnails are ordered, and a link is made to the PageViewer to synchronize the views and a link is made to the PDF document.

PDF-Controls-Thumbnail-viewer.png
1 TallComponents.Interaction.LayoutManagers.AutoColumnGridLayoutManager autoColumnGridLayoutManager1 = 2 new TallComponents.Interaction.LayoutManagers.AutoColumnGridLayoutManager(); 3 TallComponents.PDF.Spacing spacing1 = new TallComponents.PDF.Spacing(); 4 TallComponents.PDF.Spacing spacing2 = new TallComponents.PDF.Spacing(); 5 6 this.thumbnailsViewer1.ActionHandler = null; 7 this.thumbnailsViewer1.Dock = System.Windows.Forms.DockStyle.Fill; 8 //couple the thumbnailsViewer to the pdf document 9 this.thumbnailsViewer1.Document = this.document1; 10 //draw a red rectangle to indicate what parts of the pdf pages are visible 11 this.thumbnailsViewer1.DrawPagesViewerRectangles = true; 12 this.thumbnailsViewer1.HideHorizontalScrollbar = false; 13 this.thumbnailsViewer1.HideVerticalScrollbar = false; 14 autoColumnGridLayoutManager1.ColumnCount = 1; 15 autoColumnGridLayoutManager1.Indent = 0; 16 spacing1.Bottom = 75; 17 spacing1.Left = 75; 18 spacing1.Right = 75; 19 spacing1.Top = 75; 20 autoColumnGridLayoutManager1.Margin = spacing1; 21 spacing2.Bottom = 75; 22 spacing2.Left = 75; 23 spacing2.Right = 75; 24 spacing2.Top = 75; 25 autoColumnGridLayoutManager1.Spacing = spacing2; 26 this.thumbnailsViewer1.LayoutManager = autoColumnGridLayoutManager1; 27 this.thumbnailsViewer1.Location = new System.Drawing.Point(0, 0); 28 this.thumbnailsViewer1.MaxZoom = 0.8; 29 this.thumbnailsViewer1.MinZoom = 0.02; 30 this.thumbnailsViewer1.Name = "thumbnailsViewer1"; 31 //couple the thumbnailsViewer to the pagesViewer to couple clicking actions 32 this.thumbnailsViewer1.PagesViewer = this.pagesViewer1; 33 this.thumbnailsViewer1.Size = new System.Drawing.Size(199, 431); 34 this.thumbnailsViewer1.TabIndex = 0; 35 this.thumbnailsViewer1.Text = "thumbnailsViewer1"; 36 this.thumbnailsViewer1.VisibleLeft = 0; 37 this.thumbnailsViewer1.VisibleTop = 0; 38 this.thumbnailsViewer1.ZoomFactor = 0.125;