Zoom Percentage
Is there a way to get or work out the zoom scale percent? i.e. I want to be able to tell if the user has an image zoomed in at 100% of the original size or 50% or 200% for example.
The new version of ZoomPanel that has been just released (v3.0) has a new property ZoomFactor. Here is an excerpt from the help file:

ZoomFactor gets or sets the zoom factor that defines how much the content of the ZoomPanel is scaled.

When ZoomFactor is 1, than the whole content will be shown in the ZoomPanel. If the content size is 100 x 100, this does not mean that the shown size will be also 100 x 100 - the shown size will depend of the size of ZoomPanel. It its size is 200 x 300, than the content's size will be 200 x 200.

When ZoomFactor is more than 1, the content is bigger - not the whole content is visible. Note that ZoomFactor is a one dimensional zoom factor. This means that when for example zoom factor is 2, only 50 x 50 pixels will be visible from the whole 100 x 100 - the width and height are both "scaled" by 2.

When ZoomFactor is less than 1, the content is smaller - there is an empty space added around the shown content.

You can also manually calculate the ZoomFactor from the Viewbox's Width and Height (Viewbox is a property on ZoomPanel that describes which area of the content is visible).

When both Width and Height are 1 this means no zoom has been applied - the whole content is shown. If Width and Height are both 0.5 than this means that only half the width and height is shown - only a 1/4 of the content is shown. In this case the ZoomFactor would be 2 - it would be the same as the content would be scaled with ScaleTransform with ScaleX and ScaleY both set to 2.
Andrej Benedik

Forum Jump:

Users browsing this thread:
1 Guest(s)