Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Images & Foxpro...

Status
Not open for further replies.

VVVA

Technical User
Sep 19, 2006
35
US
I'm totally new to foxpro...been playing with it over the weekend. I got an image control on my form, and I'm wondering how to zoom, pan, rotate, ect. Are these functions in the image control somewhere, & I'm just missing them...or is there a better image control out there I should be using?
 
Hi VVVA,

Welcome to Visual FoxPro, and to the forum.

The Image control is designed mainly just to display static images on a form. You can rotate the image by setting the control's RotateFlip property. You can also resize the control by changing its Height and Width. If the resized control is smaller than its contained image, the Stretch property says whether the image should be clipped or resized.

However, there is no way to pan or zoom an image using the Image control. If you want more than the basic features, you should use some alternative way of displaying images, such as an ActiveX control. The Kodak Imaging control might be one possibility.

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike said:
However, there is no way to pan or zoom an image using the Image control.
It's relatively simple to enable zooming in and out of an image control.


You can use the .MouseWheel() event, cmdbuttons, the Microsoft Slider control, etc to effect this.

Set the .Stretch property of the Image control to 1, and proportionally increase or decrease the dimensions of the image control thus zooming in or out.

FAQ184-2483​
Chris [pc2]
PDFcommander.com
motrac.co.uk
 
VVVA

Another consideration - as the Image control only supports raster image types, you will need to control the maximum zoom level.

Depending on the actual image, this may be as low as 105/110% or as high as 115/120% of the original image size before the image visually degrades.

So the technique suggested will not be much use on say 16x16 pixel images, but will be effective on any image of a substantial size.

FAQ184-2483​
Chris [pc2]
PDFcommander.com
motrac.co.uk
 
Chris,

Set the .Stretch property of the Image control to 1, and proportionally increase or decrease the dimensions of the image control thus zooming in or out.

But that doesn't zoom the picture. It merely resizes it. If I understand this right, zooming means increasing or decreasing the size of an image within a given space. Or am I missing something?

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike said:
If I understand this right, zooming means increasing or decreasing the size of an image within a given space.
That's what exactly what the technique does.


With respect, the question of whether or not it actually zooms the picture, becomes academic.

The given space can be a form or a container within a form - either way you're increasing or decreasing the size of an image within the form or container.

If you extend the technique you can develop apps that allow users to zoom, pan, rotate, crop and thus create new images, (saved by selective screen capture), from existing images using a simple combination of container and image control.

FAQ184-2483​
Chris [pc2]
PDFcommander.com
motrac.co.uk
 
Chris,

Fair comment. I was thinking that the desired behaviour would be to vary the size of the image within the boundaries of its container. But you're right that zooming also implies increasing or decreasing the container size.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
You could also put the image control inside a container control, then increase the image control size, but clip it with the outer container. That also makes it possible to pan by positioning image.left and .top eg to negative values.

Bye, Olaf.
 
Olaf

I place a transparent shape over a container containing the image control on a form.

You can then use the right mouse to move/resize the container within the form or SHIFT + right mouse to move the image control within the container, the transparent shape 'passing on' the instructions to the underlying controls.

Once the user has resized the container to their liking, zoomed in or out of the image and/or moved the image control within the container, then selective screen capture will create a new resized cropped image derived from the original.

FAQ184-2483​
Chris [pc2]
PDFcommander.com
motrac.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top