←Select platform

PageCount Property

Summary

Get the number of pages in Image.

Syntax
C#
C++/CLI
public int PageCount { get; } 
public:  
   property int PageCount 
   { 
      int get() 
   } 

Property Value

The total number of pages in Image. Will return 0 if Image is null.

Remarks

This value is used since RasterImage supports multipage images (frames). ImageViewerPagerInteractiveMode uses the value of this property to find the maximum value when cycling through the pages of a multipage image in an item.

For more information, refer to Image Viewer Items.

Example
C#
using Leadtools; 
using Leadtools.Controls; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
 
 
public ImageViewerForm _form = new ImageViewerForm(); 
public ImageViewer _imageViewer; 
 
public void ImageViewerPageNumberExample() 
{ 
   // Get the Form's ImageViewer control 
   _imageViewer = _form.ImageViewer; 
 
   if (_imageViewer.Items.Count > 0) 
   { 
      var item = _imageViewer.ActiveItem; 
      var image = item != null ? item.Image : null; 
      var pageCount = (image != null) ? image.PageCount : 1; 
 
      if (pageCount > 1) 
      { 
         var oldPageNumber = item.PageNumber; 
         var newPageNumber = oldPageNumber; 
         newPageNumber++; 
 
         newPageNumber = Math.Max(1, Math.Min(pageCount, newPageNumber)); 
         if (newPageNumber != oldPageNumber) 
         { 
            item.PageNumber = newPageNumber; 
         } 
      } 
      else 
      { 
         var index = _imageViewer.Items.IndexOf(_imageViewer.ActiveItem); 
         index++; 
 
         if (index >= 0 && index < _imageViewer.Items.Count) 
            _imageViewer.ActiveItem = _imageViewer.Items[index]; 
      } 
   } 
} 
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.Controls Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.