←Select platform

ImageViewerItem Class

Summary

Represents an ImageViewer item containing its own image data, size and optional additional transformation.

Syntax
C#
C++/CLI
public class ImageViewerItem 
public ref class ImageViewerItem 
Remarks

ImageViewer supports one or more items with each containing its own image data, size and optional additional transformation.

ImageViewerItem supports raster image or SVG data.

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 ImageViewerItems_Example() 
{ 
 
   // Clear all the images already the viewer 
   _imageViewer.Items.Clear(); 
   // Use vertical view layout 
   _imageViewer.ViewLayout = new ImageViewerVerticalViewLayout(); 
   _imageViewer.ImageBorderThickness = 1; 
 
   // Add 4 items to the viewer 
   using (var codecs = new RasterCodecs()) 
   { 
      for (var page = 1; page <= 4; page++) 
      { 
         var item = new ImageViewerItem(); 
         var fileName = Path.Combine(LEAD_VARS.ImagesDir, string.Format("ocr{0}.tif", page)); 
         item.Image = codecs.Load(fileName, 100, 100, 24, RasterSizeFlags.Resample, CodecsLoadByteOrder.BgrOrGray, page, page); 
         // Set the tag of each item to be the page number 
         item.Tag = page; 
         _imageViewer.Items.Add(item); 
      } 
   } 
 
   // Show the count 
   Debug.WriteLine("This must say 4: " + _imageViewer.Items.Count); 
 
   // Remove the item at index 1 (page 2) 
   _imageViewer.Items.RemoveAt(1); 
   Debug.WriteLine("This must now say 3: " + _imageViewer.Items.Count); 
 
   // Loop through each item and show the tag, since we remove page 2, it must say 1, 3, 4 
   foreach (var item in _imageViewer.Items) 
   { 
      var pageNumber = (int)item.Tag; 
      Debug.WriteLine(pageNumber.ToString()); 
   } 
 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
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.