Zooming with GdViewerBox

Example requests & Code samples for GdPicture Toolkits.
Post Reply
DriverTech
Posts: 9
Joined: Fri Dec 14, 2012 10:00 pm

Zooming with GdViewerBox

Post by DriverTech » Mon Jul 29, 2013 11:00 pm

Hello,

I need a simple code snippet that allows me to zoom in/out a displayed image when using the GdViewerBox in C#.

My library version is 9.4.0.12

I have tried the following:

Code: Select all

GdViewerBox.LockViewer = true;
GdViewerBox.Zoom = GdViewerBox.Zoom * 1.1;
GdViewerBox.ZoomIN(); // Tried both this and setting zoom individually
GdViewerBox.Invalidate(true);
GdViewerBox.Redraw();
GdViewerBox.Refresh();
GdViewerBox.LockViewer = false;
Nothing I do will update the zoom on the displayed image. These calls are in a method that is being invoked.

The best I could do was

Code: Select all

GdViewerBox.Zoom = GdViewerBox.Zoom * 1.1;
And then display a different image. The new image would take on the new zoom level.

Thanks for your help

Brendan

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

Re: Zooming with GdViewerBox

Post by SamiKharma » Tue Jul 30, 2013 12:56 pm

Hi,

Please try taking out

Code: Select all

GdViewerBox.LockViewer = true;
and just call:

Code: Select all

ZoomIN()
Best,
Sami

DriverTech
Posts: 9
Joined: Fri Dec 14, 2012 10:00 pm

Re: Zooming with GdViewerBox

Post by DriverTech » Tue Jul 30, 2013 5:49 pm

Thank you for the reply. I tried this and it still does not zoom in at all. What is an appropriate zoom step for zooming 50%? Also, what should I set for ZoomMode on the GdViewerBox?

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

Re: Zooming with GdViewerBox

Post by SamiKharma » Wed Jul 31, 2013 12:21 pm

Hi,

I am not sure what you are doing. Zooming works fine in the latest release. Please have a look at the VB.NET Image Processing Demo, it has a '+' button under the viewer, which basically calls the ZoomIN() function. If that does not work, please report back. If it does, then do something like it in your app.

Best,
Sami

DriverTech
Posts: 9
Joined: Fri Dec 14, 2012 10:00 pm

Re: Zooming with GdViewerBox

Post by DriverTech » Thu Aug 01, 2013 10:50 pm

I figured out how to make it work. After calling ZoomIn() I must then call GdViewer.DisplayFromGdPictureImage(ImagePath); so that it will draw the image again with the new zoom. This is very un-obvious and one would assume that simply calling GdViewer.Refresh() or Redraw() would handle this. Nowhere in the documentation does it specify that you must re display the image after calling ZoomIn().

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Zooming with GdViewerBox

Post by Loïc » Fri Aug 02, 2013 10:11 am

Hi,
Nowhere in the documentation does it specify that you must re display the image after calling ZoomIn().
This is normal since, of course, the image don't have to be reloaded from its source to apply any viewing operation.

My guess is you are closing the image before trying to zoom it...

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest