←Select platform

Reason Property

Summary

Reason why the error occurred.

Syntax
C#
C++/CLI
public ImageViewerItemChangedReason Reason { get; } 
public:  
   property ImageViewerItemChangedReason^ Reason 
   { 
      ImageViewerItemChangedReason^ get() 
   } 

Property Value

The reason why the error occurred.

Example
C#
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 ImageViewerItemChangedExample() 
{ 
   // Get the Form's ImageViewer control 
   _imageViewer = _form.ImageViewer; 
 
   // ImageViewerItemChangedEventArgs reference 
   _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"); 
      Debug.WriteLine(sb.ToString()); 
 
      if (item.Url != null) 
         Debug.WriteLine("  Url:" + item.Url.ToString()); 
   }; 
 
   // ImageViewerItemErrorEventArgs reference 
   _imageViewer.ItemError += (sender, e) => 
   { 
      e.RemoveEmptyItem = false; 
      Debug.WriteLine("Data: {0}, Error: {1}", e.Data, e.Error); 
   }; 
 
   // Load an image 
   using (var codecs = new RasterCodecs()) 
      _imageViewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif")); 
 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

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