Does anyone know how to zoom (+ or -) a picture in a picture box. Please give me the code.
Thanks.
Printable View
Does anyone know how to zoom (+ or -) a picture in a picture box. Please give me the code.
Thanks.
Maybe you want to stretch a part of the picture (where you want to zoom)... So use StretchBlt
Example is on my page :)
Recently, I have done some performance research with graphical functions. Paintpicture is faster than stretchblt in this case
Can you PLEASE give a code for zooming out and in a picture in a picture box. It would be of great help to me.
Thanks.
Kinjal
Wow! They just changed the outlook of this site again.
Ok, speed is here the zoomfactor.
Code:With Picture1
.Picture = .Image
.PaintPicture Picture1, 0, 0, .ScaleWidth, .ScaleHeight, .ScaleWidth / speed, .ScaleHeight / speed, .ScaleWidth - .ScaleWidth / speed * 2, .ScaleHeight - .ScaleHeight / speed * 2
End With
I would use the BitBlt API. Its great for working with images. If you don't know how to use it then simply goto the tutorial section of Lucky's VB Gaming Site.
Bitblt surely is fastest but it doesn't stretch
Try the StretchBlt API then. It stretches where BitBlt does not (I think).
John
That's right. But I heared PaintPicture is faster (and can also stretch)...
Just (if you care) read trough this thread and you know what I mean
Hello Kedanan
Your code worked excellent for magnifying!
But how do I use your code to demagnify the picture? What are the changes required in the code? Hoe to maintain the aspect ratio of the picture?
Thanks.
Kinjal
Hello FOX
Your example did not work on my picture box, i don't know why? I have drawn grid on my picture box using picture.pset
and also draw lines. But none of them are magnified using your code.
Kinjal
Which example did you download? The Screenshot demo uses StretchBlt to resize the captured picture so if you want to zoom into a picture you have to replace the DCs and coordinates of StretchBlt call...
Just set speed to a negative value. :) With paintpicture you should be able to mirror & flip the picture too. To get the ratio, just use some math.
No...oops :(Quote:
Just (if you care) read trough this thread and you know what I mean
Sorry!
John
John, could you make some color options for me (i don't like the purple background)?