←Select platform

ControlSizeMode Enumeration

Summary

Determines how the control displays the image and the automatic adjustments of the display rectangles.

Syntax
C#
C++/CLI
public enum ControlSizeMode 
public enum class ControlSizeMode sealed 
Members

0

None

(0) No special sizing

1

ActualSize

(1) Use the image actual size

2

Fit

(2) Fit the image into the viewing area while maintaining the aspect ratio. If the image size is smaller than the viewing area, no resizing is done.

3

FitAlways

(3) Always fit the image into the viewing area while maintaining the aspect ratio even if the image size is smaller than the viewing area (in which case, the image will be scaled up).

4

FitWidth

(4) Fit the image width to be the size of the width of the viewing area while maintaining the aspect ratio.

5

FitHeight

(5) Fit the image height to be the size of the height of the viewing area while maintaining the aspect ratio.

6

Stretch

(6) Fit the image to fill the viewing area. Aspect ratio might not be maintained.

Remarks

ControlSizeMode is used by the ImageViewer.Zoom and ImageViewerItem.Zoom methods.

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 ImageViewerZoomExample() 
{ 
   // Get the ImageViewer control 
   _imageViewer = _form.ImageViewer; 
 
   // Load an image 
   using (var codecs = new RasterCodecs()) 
      _imageViewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Ocr1.tif")); 
 
   // Set Zoom to Fit Page Width 
   _imageViewer.Zoom(ControlSizeMode.FitWidth, 1, _imageViewer.DefaultZoomOrigin); 
} 
 
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.