Get the number of pages in Image.
public int PageCount { get; }
public:
property int PageCount
{
int get()
}
The total number of pages in Image. Will return 0 if Image is null.
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.
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];
}
}
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document