←Select platform

View Property

Summary

Manages the main content view in this document viewer

Syntax
C#
C++/CLI
public DocumentViewerView View { get; } 
public:  
   property DocumentViewerView^ View 
   { 
      DocumentViewerView^ get() 
   } 

Property Value

The DocumentViewerView object that manages the thumbnails in this document viewer.

Remarks

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.

Example
C#
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 once 
exampleButton.Enabled = false; 
 
// Get the view 
var view = _documentViewer.View; 
// Get its image viewer 
var imageViewer = view.ImageViewer; 
// Hook to the PostRender 
imageViewer.PostRenderItem += (sender, e) => 
{ 
   // Get the image viewer item for the page 
   var item = e.Item; 
 
   // Get the current rectangle for the image 
   var bounds = imageViewer.GetItemViewBounds(item, ImageViewerItemPart.Image, false); 
 
   // Build the text we want. The page number is the item index + 1 
   var pageNumber = imageViewer.Items.IndexOf(item) + 1; 
   var text = "Page " + pageNumber.ToString(); 
 
   // Get the image transformation for this item 
   var transform = imageViewer.GetItemImageTransform(e.Item); 
 
   // Apply it to the context 
   var 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 bounds 
   var 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 time 
view.Invalidate(); 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document.Viewer.WinForms Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.