Occurs when any of the items inside this ImageViewer changes
public event EventHandler<ImageViewerItemChangedEventArgs> ItemChanged
Public Event ItemChanged As EventHandler(Of Leadtools.Controls.ImageViewerItemChangedEventArgs)
public:
event EventHandler<Leadtools::Controls::ImageViewerItemChangedEventArgs^>^ ItemChanged
This event occurs when any of the items inside this ImageViewer changes. The ImageViewerItemChangedEventArgs will contain the item that has been changed in ImageViewerItemChangedEventArgs.Item and the reason for the change in ImageViewerItemChangedEventArgs.Reason.
Change the value of the following properties or calling the methods programmatically or by the viewer will raise the ItemChanged event with the specified reason:
Property or Method | Value of ImageViewerItemChangedEventArgs.Reason |
---|---|
Image | ImageViewerItemChangedReason.Image (and optionally ImageViewerItemChangedReason is automatically changed by the viewer. |
SvgDocument | ImageViewerItemChangedReason.Image (and optionally ImageViewerItemChangedReason is automatically changed by the viewer. |
Url | ImageViewerItemChangedReason.Image (and optionally ImageViewerItemChangedReason is automatically changed by the viewer. |
ImageSize | |
PageNumber | ImageViewerItemChangedReason.Image (and optionally ImageViewerItemChangedReason is automatically changed by the viewer. |
Size | |
Resolution | |
BackImage | |
BackImageUrl | |
Floater | |
FloaterTransform | |
FloaterOpacity | |
Text | |
IsSelected | |
IsHovered | |
IsEnabled | |
IsVisible | |
Transform | |
Zoom | |
ResizeOnTransform | |
ClipImageToContent | |
ImageHorizontalAlignment | |
ImageVerticalAlignment | |
TextHorizontalAlignment | |
TextHorizontalAlignment |
The viewer automatically listens to these events internally and will perform the necessary action, for example, if any property that affect the transformation changes, UpdateTransform will be called. If the property change requires rendering only, then the item will be invalidated.
This example will track the ItemChanged and ItemError event and show information on them.
Run the demo, click the Example button.
Start with the ImageViewer example, remove all the code inside the example function (search for the "// TODO: add example code here" comment) and insert the following code:
using Leadtools;
using Leadtools.Controls;
using Leadtools.Codecs;
using Leadtools.Drawing;
using LeadtoolsExamples.Common;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
_imageViewer.ItemChanged += (sender, e) =>
{
var item = e.Item;
var sb = new StringBuilder();
sb.AppendFormat("ItemChanged:{0} Reason:{1} Size:{2} Res:{3}", _imageViewer.Items.IndexOf(item), e.Reason, item.Size, item.Resolution);
if (item.Image != null)
sb.AppendFormat(" Image: {0}bpp {1} by {2}", item.Image.BitsPerPixel, item.Image.Width, item.Image.Height);
else
sb.AppendFormat(" Image: null");
Console.WriteLine(sb.ToString());
if (item.Url != null)
Console.WriteLine(" Url:" + item.Url.ToString());
};
Imports Leadtools
Imports Leadtools.Controls
Imports Leadtools.Codecs
Imports Leadtools.Drawing
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Color
Imports LeadtoolsControlsExamples.LeadtoolsExamples.Common
AddHandler _imageViewer.ItemChanged,
Sub(sender, e)
Dim item As ImageViewerItem = e.Item
Dim sb As New StringBuilder()
sb.AppendFormat("ItemChanged:{0} Reason:{1} Size:{2} Res:{3}", _imageViewer.Items.IndexOf(item), e.Reason, item.Size, item.Resolution)
If Not item.Image Is Nothing Then
sb.AppendFormat(" Image: {0}bpp {1} by {2}", item.Image.BitsPerPixel, item.Image.Width, item.Image.Height)
Else
sb.AppendFormat(" Image: null")
End If
Console.WriteLine(sb.ToString())
If Not item.Url Is Nothing Then
Console.WriteLine(" Url:" & item.Url.ToString())
End If
End Sub
Parameter | Type | Description |
---|---|---|
sender | object | The source of the event. |
e | ImageViewerItemChangedEventArgs | The event data. |
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