:: On Wed, 13 Apr 2022 07:26:02 -0700 (PDT)
:: (microsoft.public.vb.general.discussion)
:: <
23ddf684-2159-4ad0...@googlegroups.com>
:: Kim Hawker <
hawke...@gmail.com> wrote:
> OK, my picture gets loaded into the picturebox but I guess I should
> of asked it more like is there any way using controls or code to
> adjust picture left to right or up and down after picture is in the
> picturebox.
Oh, but that's easy, let me try an example
put a picturebox (Picture1) on a form and size it as you need
add an horizontal and a vertical scrollbars (Hscroll1, Vscroll1) to the
right and bottom sides of the picturebox
add a second picturebox (Picture2) INSIDE the first one (Picture1) and
set Picture2 so that it will autoresize to the size of the image and
set its borderstyle to none
set both scrollbars to disabled (or invisible if you prefer)
now load your image into Picture2 (NOT Picture1, that's just a
container or, if you prefer, our "viewport"), Picture2 will resize to
the image size and if the image is bigger than Picture1 you'll only see
the top left "chunk" of the image
if the image is bigger than Picture1, enable (or show) the horizontal
and/or vertical scrollbars and set their max value to 1/2 of the width
or height of the image
now, in the scrollbars "scroll" event change the "top" or "left2 of
picture 2 to -1*value, where value is the scrollbar value
done ... ok, will need some refinement, but I think you got the idea