Optional user defined data associated with this item.
public object Tag { get; set; }
public:
property Object^ Tag
{
Object^ get()
void set(Object^ value)
}
The optional user defined data associated with this item. Default value is null.
This value is not used by LEADTOOLS. You can set any value here for the purpose of your application.
For more information, refer Image Viewer Items.
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 ImageViewerItemsExample()
{
// Get the Form's ImageViewer control
_imageViewer = _form.ImageViewer;
// Clear all the images already the viewer
_imageViewer.Items.Clear();
_imageViewer.BeginUpdate();
// 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("Item Count: " + _imageViewer.Items.Count);
// Remove the item at index 1 (page 2)
_imageViewer.Items.RemoveAt(1);
Debug.WriteLine("Item Count: " + _imageViewer.Items.Count);
// Loop through each item and show the tag, since page 2 is removed, it must say 1, 3, 4
foreach (var item in _imageViewer.Items)
{
var pageNumber = (int)item.Tag;
Debug.WriteLine(pageNumber.ToString());
}
_imageViewer.EndUpdate();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}
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