←Select platform

ItemChanged Event

Summary

Occurs when any of the items inside this ImageViewer changes.

Syntax
C#
VB
C++
public event EventHandler<ImageViewerItemChangedEventArgs> ItemChanged 
Public Event ItemChanged As EventHandler(Of Leadtools.Controls.ImageViewerItemChangedEventArgs) 
public: 
   event EventHandler<Leadtools::Controls::ImageViewerItemChangedEventArgs^>^ ItemChanged 
Remarks

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

ImageViewerItemChangedReason.Image

PageNumber
ImageViewerItemChangedReason.Image (and optionally ImageViewerItemChangedReason
is automatically changed by the viewer.)
Size

ImageViewerItemChangedReason.Size

Resolution

ImageViewerItemChangedReason.Resolution

BackImage

ImageViewerItemChangedReason.BackImage

BackImageUrl

ImageViewerItemChangedReason.BackImageUrl

Floater

ImageViewerItemChangedReason.Floater

FloaterTransform

ImageViewerItemChangedReason.FloaterTransform

FloaterOpacity

ImageViewerItemChangedReason.FloaterTransform

Text

ImageViewerItemChangedReason.Text

IsSelected

ImageViewerItemChangedReason.Selected

IsHovered

ImageViewerItemChangedReason.Hovered

IsEnabled

ImageViewerItemChangedReason.Transform

IsVisible

ImageViewerItemChangedReason.Transform

Transform

ImageViewerItemChangedReason.Transform

Zoom

ImageViewerItemChangedReason.Transform

ResizeOnTransform

ImageViewerItemChangedReason.Transform

ClipImageToContent

ImageViewerItemChangedReason.Transform

ImageHorizontalAlignment

ImageViewerItemChangedReason.Transform

ImageVerticalAlignment

ImageViewerItemChangedReason.Transform

TextHorizontalAlignment

ImageViewerItemChangedReason.Transform

TextHorizontalAlignment

ImageViewerItemChangedReason.Transform

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.

Example

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:

C#
VB
using Leadtools; 
using Leadtools.Controls; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
 
 
public void ImageViewerItemChanged_Example() 
{ 
   _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 
 
Public Sub ImageViewerItemChanged_Example() 
 
   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 
End Sub 
Event Data
ParameterTypeDescription
senderobjectThe source of the event.
eImageViewerItemChangedEventArgsThe event data.
Requirements
Target Platforms
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Controls Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.