Discussion:
Dynamic Image in Picture Box
(too old to reply)
Yogesh P
2014-01-08 11:03:03 UTC
Permalink
Hi,
Am new to VB. My requirement is simple.
I want to load images into a picture box one by one upon mouse click of a command button.
Say..i will have 100 images in a folder in local(C:\Users\Desktop\Images)
I want to load first image into Picture box while the form load.
Then upon clicking a command button i want the next image to be loaded in the Picture Box.

Also need to zoom in and out of the picures if possible.
Thanks in advance.

Regards,
YOgesh P
DaveO
2014-01-08 15:03:50 UTC
Permalink
Post by Yogesh P
Hi,
Am new to VB. My requirement is simple.
I want to load images into a picture box one by one upon mouse click of a command button.
Say..i will have 100 images in a folder in local(C:\Users\Desktop\Images)
I want to load first image into Picture box while the form load.
Then upon clicking a command button i want the next image to be loaded in the Picture Box.
Also need to zoom in and out of the picures if possible.
Thanks in advance.
Regards,
YOgesh P
The LoadPicture function does exactly what it says so that part is quite
easy.

Zooming is more interesting as selecting which portion to view could be
tricky, the actual enlargement can be done with the StretchBlt API or by
using a Image control instead of a PictureBox as it has a Stretch property.

The easiest way I can think of would be to place an Image of 4 times the
size of the picture inside a PictureBox then load the picture to the Image
control and you now have a magnified view of 1/16th of the image and you can
then work out what method you want to use to move the viewport around. Not
all that elegant but it should work.

These suggestions relate to VB6, if you are using a later version of VB then
it will probably require a slightly different approach.

DaveO.

Loading...