Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.4.3
|
Leadtools.Controls Assembly > Leadtools.Controls Namespace > ImageViewer Class : ItemChanged Event |
public event EventHandler<ImageViewerItemChangedEventArgs> ItemChanged
'Declaration
Public Event ItemChanged As EventHandler(Of ImageViewerItemChangedEventArgs)
The event handler receives an argument of type ImageViewerItemChangedEventArgs containing data related to this event. The following ImageViewerItemChangedEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Item | Item that has changed. |
Reason | Reason behind the change. |
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:
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.
ImageViewerItemChangedEventArgsThis 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:
Imports Leadtools Imports Leadtools.Controls Imports Leadtools.Codecs Imports Leadtools.Drawing Imports Leadtools.ImageProcessing Imports Leadtools.ImageProcessing.Color 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
using Leadtools; using Leadtools.Controls; using Leadtools.Codecs; using Leadtools.Drawing; 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()); };