Indicates whether to automatically dispose item images, SVG documents and floaters.
public virtual bool AutoDisposeImages { get; set; }
Public Overridable Property AutoDisposeImages() As Boolean
Get
Set
public:
virtual property bool AutoDisposeImages
{
bool get()
void set(bool value)
}
true to automatically dispose item images, SVG documents and floaters; otherwise, false. Default value is true.
When the value of the AutoDisposeImages is set to true, the image viewer will automatically call the RasterImage.Dispose method on an item's Image, SvgDocument and Floater when the item is removed from the Items collection or when the control itself is disposed.
The control will check if an image is used with multiple items (for example, if multiple items are using the same image but to show different pages). In this case, the control will correctly dispose the image only once.
If you setup the items with images that you do not want to dispose of and are going to re-use somewhere else, you need to set the value of the AutoDisposeImages property to false.
You can also temporarily change the value of the AutoDisposeImages property if you want to save the item image before you dispose it. For example, set the AutoDisposeImages property to false, call "Removed" on the Items collection to remove the item, then re-set the AutoDisposeImages property back to true.
Note that if you set the AutoDisposeImages value to false and you do not dispose the item images yourself, the .NET garbage collector will eventually detect that these images are not used anymore and will dispose them for you when the control and any other reference to these images are no longer used in your application. This is not recommended since the image data contains unmanaged memory and resources that are not returned to the system even though the owner object is no longer used.
For more information, refer to Image Viewer Items.
This example will show the effect of AutoDisposeImages.
using Leadtools;
using Leadtools.Controls;
using Leadtools.Codecs;
using Leadtools.Drawing;
using LeadtoolsExamples.Common;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
// Make a copy of the image in viewer and save it
RasterImage image2 = _imageViewer.Image;
// Set a copy in the viewer, this is the image we will change here
_imageViewer.AutoDisposeImages = false;
_imageViewer.Image = image2.Clone();
_imageViewer.AutoDisposeImages = true;
Imports Leadtools
Imports Leadtools.Controls
Imports Leadtools.Codecs
Imports Leadtools.Drawing
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Color
Imports LeadtoolsControlsExamples.LeadtoolsExamples.Common
' Make a copy of the image in viewer and save it
Dim image2 As RasterImage = _imageViewer.Image
' Set a copy in the viewer, this is the image we will change here
_imageViewer.AutoDisposeImages = False
_imageViewer.Image = image2.Clone()
_imageViewer.AutoDisposeImages = True
Products |
Support |
Feedback: AutoDisposeImages Property (ImageViewer) - Leadtools.Controls |
Introduction |
Help Version 19.0.2017.6.20
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.