Calculating Zoom factor (Image to Fit)

  Imaging Toolkit

Question:

How do I know what the custom zoom factor should be if I want to:
fit image to width
fit to height
fit image (width and height)

Answer:

The zoom factor can be calculated based on the size of the image, the screen DPI and the size of your current window.

If you just need the ScaleToWidth, FitToWindow, etc. functionality, use the Scalemode property instead of zooming:

http://www.blackice.com/Help/Tools/Image%20OCX%20webhelp/WebHelp/

ScaleMode Property
Description Determines the method of how a picture stretches to fit the size of a BIDisp control.

Usage [form.]BIDisp.ScaleMode [= setting]

Settings The ScaleMode property settings for a TIFF control are:

Setting Description

tifsmFitToWindow = 0 (Default) FitToWindow. The picture is resized to fit the control.

tifsmNoScale = 1 NoScale. Put the picture onto the control without scaling.

tifsmScaleToWidth = 2 ScaleToWidth. The picture is resized to fit the control horizontally.

tifsmScaleToHeight = 3 ScaleToHeight. The picture is resized to fit the control vertically.

tifsmFitProportionally = 4 FitProportionally. The picture is resized with a unique scaling factor of both a vertical and horizontal direction to fit the control.

Remarks The scaling mode 1, 2 and 3 can use scroll bars.

Data Type Integer (Enumerated)

Regards,
Technical Support Team