←Select platform

ImageViewerAutoResetOptions Enumeration

Summary

Specifies options to control which display properties get reset when an image is set into the control.

Syntax
C#
C++/CLI
[FlagsAttribute()] 
public enum ImageViewerAutoResetOptions 
public [FlagsAttribute] 
   enum class ImageViewerAutoResetOptions sealed 
Members

0x00000000

None

(0) None of the properties will reset back to their default values.

0x00000001

Scroll

(1) The horizontal and vertical scroll offsets (ImageViewer.ScrollOffset) location will reset back to the top-left position (0,0)

0x00000002

Zoom

(2) Reset ImageViewer.ScaleFactor back to 1.0 and ImageViewer.SizeMode to ControlSizeMode. This will call Zoom to set these values.

0x00000004

Transformation

(4) Reset ImageViewer.Flip, ImageViewer.Reverse and ImageViewer.RotateAngle back to false, false and 0 respectively.

0x00000008

Effects

(8) Resets ImageViewer.Invert back to false

0x0000000F

All

(16) All the properties will reset back to their default values

Remarks

Use the ImageViewer.AutoResetOptions property to control which of the display properties of the control resets back to its default value when a new image is set in the viewer.

Use a logical OR operation to combine any of the above options together. By setting these options, you can achieve effects such as if the control has a scale factor value of 1.5 (150 percent) and a new image is set, the scale factor does not reset and stays at 150 percent instead of going back to 100 percent.

Used when the viewer is not used with multiple items. For more information, refer to Image Viewer in Single Item Mode.

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(); 
private ImageViewer _imageViewer; 
 
public void ImageViewerAutoResetOptionsExample() 
{ 
   // Get the Form's ImageViewer control 
   _imageViewer = _form.ImageViewer; 
 
   // Change AutoResetOptions 
   _imageViewer.AutoResetOptions = ImageViewerAutoResetOptions.None; 
 
   // Load an image 
   using (var codecs = new RasterCodecs()) 
      _imageViewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif")); 
 
   // Change Zoom 
   _imageViewer.Zoom(ControlSizeMode.None, 1.4, _imageViewer.DefaultZoomOrigin); 
 
   // Load new image on click 
   _imageViewer.Click += _imageViewer_Click; 
} 
 
private void _imageViewer_Click(object sender, EventArgs e) 
{ 
   // Load another image, zoom scale factor is maintained 
   using (var codecs = new RasterCodecs()) 
      _imageViewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Ocr2.tif")); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

See Also

Reference

Leadtools.Controls Namespace

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.