Zooming

Are there any objects that allow zooming in on images?

How would I write a routine to magnify the image (x2, x4, x8) based on user input, and resize the form accordingly?
rgrovesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

karlwwCommented:
What are you using to display the images?  A picture box?  If so, you can use VB's PaintPicture to stretch it.  You could also try some third party imaging controls like ImageMan from www.data-tech.com
0
rgrovesAuthor Commented:
Yeah, I'm using the picture control.

I'm really looking for a routine/code that handles the whole deal. For example, when the user clicks, the image will be expanded along with the form. But if the form expands larger than the screen size, there would need to be scroll bars.

Each time the user clicks, the image would expand a little more. You know, just like using a paint program.

0
RuchiCommented:
Place two picture boxes and a command button on the form. This following code is from the question and answer forum.

Option Explicit
Private Sub Form_Load()
    Picture1.Picture = LoadPicture("c:\Winnt\winnt.bmp")
    Picture1.AutoRedraw = True
    Picture2.AutoRedraw = True
    Picture2.Visible = False
    Picture1.ScaleMode = vbPixels
    Picture2.ScaleMode = vbPixels
    Picture2.Move 0, 0, Picture1.Width, Picture2.Height
    Picture1.MousePointer = vbCrosshair
End Sub
Private Sub Command1_Click()
    Static bZoom As Boolean
    bZoom = Not bZoom
    If bZoom Then
        'Zoom in 10x on Top Left of Image
        With Picture1
            Picture2 = Picture1
            .PaintPicture .Picture, 0, 0, .ScaleWidth, .ScaleHeight, 0, 0, .ScaleWidth / 10, .ScaleHeight / 10
            Picture1 = .Image
        End With
    Else
        'Zoom Back out to 100%
        Picture1 = Picture2.Image
    End If
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbLeftButton Then
        'Draw on Normal Sized Picture
        Picture2.PSet (X / 10, Y / 10)
        With Picture1
            'Recopy Zoomed Image to Give Illusion of Drawing on Zoomed Image..
            .PaintPicture Picture2.Image, 0, 0, .ScaleWidth, .ScaleHeight, 0, 0, .ScaleWidth / 10, .ScaleHeight / 10
        End With
    End If
End Sub
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

rgrovesAuthor Commented:
Where am I supposed to position the picture boxes? Overlapping?

How is this function supposed to work? When I try it, it just makes a black square on my picture.
0
RuchiCommented:
When you click on the picture, there is a black square on it. You click on the command button, and the picture will expand. When you click again on the command button, the picture will go back to the normal. The code I gave you is from the web.
0
rgrovesAuthor Commented:
Why does it only zoom in on the upper-left corner of the picture?
0
rgrovesAuthor Commented:
Why does it only zoom in on the upper-left corner of the picture?
0
ZLeaderCommented:
Try the ImgEdit control.  It can open, print, zoom, annotate (freehand line, straight line, rectangle, highlighter, rubber stamps ((which you can design)), and more), has scrollbars built in, etc. etc.

Best of all, it's free and you may even have sample code on your system showing you how to invoke all these functions.

0
rgrovesAuthor Commented:
Do you mean imagEdit? I think that's a C++ function.

0
rgrovesAuthor Commented:
Well, I found a function in another question on this site that answers the zoom part better.

But no one has answered how to resize the window to fit the zoomed image, and how to add scrolling if the window gets bigger than the screen, etc.

I couldn't find the imgEdit sample.
0
RuchiCommented:
I am going to withdraw my answer and make it a comment.

http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?lngWId=1&txtCodeId=1586
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rgrovesAuthor Commented:
Woah.. that looks exactly like what I want to do. I'll just go with this.

Thanks for all your help.
0
ZLeaderCommented:
See below for information on the controls.  If you need them, I/someone could give them to you.  I believe they are freeware.  Note though that there is an expanded retail version available on the below site that does faxing, possibly OCR, etc....

http://www.eastmansoftware.com/products/ImagingPro/dev_guide.htm

E-mail me at admsfmlyAmindspring.com if you would like the controls and sample app.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.