Manages the main content view in this document viewer
public DocumentViewerView View { get; }
The DocumentViewerView object that manages the thumbnails in this document viewer.
This class manages the main content to view the pages of the current LEADDocument set in the document viewer.
Refer to DocumentViewerView for more information.
using Leadtools;using Leadtools.Controls;using Leadtools.Document;using Leadtools.Document.Viewer;using Leadtools.Codecs;using Leadtools.Caching;using Leadtools.Annotations.Engine;using Leadtools.Ocr;// Disable the example button, this should only run onceexampleButton.Enabled = false;// Get the viewvar view = _documentViewer.View;// Get its image viewervar imageViewer = view.ImageViewer;// Hook to the PostRenderimageViewer.PostRenderItem += (sender, e) =>{// Get the image viewer item for the pagevar item = e.Item;// Get the current rectangle for the imagevar bounds = imageViewer.GetItemViewBounds(item, ImageViewerItemPart.Image, false);// Build the text we want. The page number is the item index + 1var pageNumber = imageViewer.Items.IndexOf(item) + 1;var text = "Page " + pageNumber.ToString();// Get the image transformation for this itemvar transform = imageViewer.GetItemImageTransform(e.Item);// Apply it to the contextvar gstate = e.Context.Save();using (var matrix = new System.Drawing.Drawing2D.Matrix((float)transform.M11,(float)transform.M12,(float)transform.M21,(float)transform.M22,(float)transform.OffsetX,(float)transform.OffsetY)){e.Context.MultiplyTransform(matrix);}// Render the text at the bottom of the boundsvar flags = TextFormatFlags.HorizontalCenter | TextFormatFlags.Bottom;var rc = new Rectangle((int)bounds.X, (int)bounds.Y, (int)bounds.Width, (int)bounds.Height);TextRenderer.DrawText(e.Context, text, imageViewer.Font, rc, Color.White, Color.Black, flags);e.Context.Restore(gstate);};// Invalidate so our changes take effect the first timeview.Invalidate();