setZoom()

Description

Sets zoom factor for the current image, only valid when fit-to-window type is set to EnumFitToWindowType.None.

Syntax

ImageViewerObject.ui.setZoom(iValue);

Parameters

<float> iValue: the value to set

Return value

bool

Remarks

The viewer will refresh to reflect the change of zoom.
Before change the value of zoom, make sure you have set fit to window type to EnumFitToWindowType.None using setFitToWindowType().

The zoom value is expressed as a percentage. The valid range is from 2 to 6500 percent (Value: 0.02 ~ 65.0); the default value is 100 percent (Value: 1.0). A zoom value can be specified before or after an image is displayed. When the zoom value is changed, the displayed image will refresh automatically.

When an error occurs, check getErrorCode() or getErrorString() for error information.

Example

if (DCSObject)
{
    var imageviewer = DCSObject.getImageViewer ("ImageViewerContainer");  // Get a specified image viewer
    imageviewer.ui.setImageViewMode(-1, -1);  // Set the view mode to -1 by -1
    imageviewer.ui.setFitToWindowType(EnumFitToWindowType.None);  //Set not to fit the width and height of the viewer.
    imageviewer.ui.setZoom(1.2);
}

See also

setImageViewMode()

setFitToWindowType()