Stops the viewer from updating the transformation matrices, view layout and rendering the content if any change is applied. This is useful to increase the control's speed efficiency.
public void BeginUpdate()
public:
void BeginUpdate()
The BeginUpdate method will cause the control to not update the image viewing transformation or invalidate the display when any changes to the control's properties or the image is applied. When the user calls the EndUpdate method, the viewer will then update the transformation and invalidate the display to show all the changes that have been made.
For better visual results and for speed efficiency, it is recommended you surround multiple calls that will cause a render or transformation change between BeginUpdate and EndUpdate.
Calls to BeginUpdate and EndUpdate are accumulative. Each call to BeginUpdate must be matched with a corresponding call to EndUpdate or else updates to the transform won't be applied.
When the final EndUpdate is called and updating is resumed, the viewer will call UpdateTransform and Invalidate to re-calculate the transformations matrices and layout and render the new content.
BeginUpdate will call BeginRender and BeginTransform while EndUpdate will call EndRender and EndTransform. The most common usage of stopping the viewer from updating will usually involve disabling both transformations update and rendering. If only rendering or only transformation is to be disabled for a specific need, then use BeginRender and BeginTransform individually.
For more information, refer to Image Viewer Rendering.
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