←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 void ImageViewerPageNumber_Example() 
{ 
   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; 
 
         if (_previousItem) 
            newPageNumber--; 
         else 
            newPageNumber++; 
 
         newPageNumber = Math.Max(1, Math.Min(pageCount, newPageNumber)); 
         if (newPageNumber != oldPageNumber) 
         { 
            item.PageNumber = newPageNumber; 
         } 
      } 
      else 
      { 
         var index = _imageViewer.Items.IndexOf(_imageViewer.ActiveItem); 
         if (_previousItem) 
            index--; 
         else 
            index++; 
 
         if (index >= 0 && index < _imageViewer.Items.Count) 
            _imageViewer.ActiveItem = _imageViewer.Items[index]; 
      } 
   } 
} 
Requirements

Target Platforms

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

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