Limit zoom factor to viewer size

Discussions about document viewing.
Post Reply
js135
Posts: 1
Joined: Thu Mar 27, 2014 6:45 pm

Limit zoom factor to viewer size

Post by js135 » Thu Mar 27, 2014 7:19 pm

Hello,

I'd like to prevent the GdPicture viewer from zooming smaller than the viewer size itself (for TIFF and PDF). Zooming in should be allowed, but zooming out should be stopped when the image is fully visible. So I am calculating the minimum allowed zoom factor for the image and comparing it to the actual zoom factor in the AfterZoomChange event. If it is smaller than my minium zoom factor, I set it back to minimum:

Code: Select all

private void ctlDocumentViewer_AfterZoomChange()
{
  // Calculate minZoom for current document ...
	
  if (gdViewer1.Zoom < minZoom)
    gdViewer1.Zoom = minZoom;
}
Now this does work, but it looks somewhat nasty: the image is zoomed smaller first and then reset to the minimum zoom factor, resulting in a short flicker. Obviously this is because I'm using the AfterZoomChange event, but I can't find any way to cancel the zoom action before it happens in the BeforeZoomChange event. So, how can I cancel a zoom action before it happens while still getting a "preview" of the zoom factor to check if it's too small?

Thanks!

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Limit zoom factor to viewer size

Post by SamiKharma » Sun Apr 13, 2014 11:35 am

Hi,

Indeed this feature is not available. If you would like to request it, please do so here:
viewforum.php?f=28

Best,
Sami

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest