Page 2 of 2 FirstFirst 12
Results 41 to 44 of 44

Thread: ZoomPictureBox: picture control with mouse-centred zooming

  1. #41
    Frenzied Member boops boops's Avatar
    Join Date
    Nov 08
    Location
    Holland/France
    Posts
    1,983

    Re: ZoomPictureBox: picture control with mouse-centred zooming

    Hi jfrazier, welcome to the forums.

    You can code the Click event subs of the buttons to change the ZoomFactor property. You could add/subtract to the present zoom factor or multiply/divide it; that's a matter of your own design. Alternatively you could use a number of buttons each to set a specific value of the ZoomFactor (1 means original image size). As an example, suppose you add a "Zoom In" button to the form. Then double click the button and put this in its Click event sub (assuming the ZoomPictureBox is named zpb1):
    Code:
    zpb1.ZoomFactor * = 1.25
    And you could put something similar but with a factor of say 0.75 in the "Zoom Out" button's Click sub.

    The scroll wheel zooming will still work as long as you don't change EnableMouseWheelZooming to False. If you are using ZoomMode "zoom to mouse position", that might look a little odd when you click a button to zoom. But it's easy to change the mode to CenterControl temporarily in the button's Click sub, for example:

    Code:
    	zpb1.ZoomMode = ZPBLibrary.ZoomPictureBox.ZoomType.ControlCenter
    	zpb1.ZoomFactor *= 1.25
    	zpb1.ZoomMode = ZPBLibrary.ZoomPictureBox.ZoomType.MousePosition
    BB

  2. #42
    New Member
    Join Date
    Nov 12
    Posts
    3

    Re: ZoomPictureBox: picture control with mouse-centred zooming

    Thank you. That was much more simple than what I was trying unsuccesfully to do. I was turning off the mouse control and then turning it back on, or at least that was what I was trying to do. It wasn't working in the least, but this works like a charm.

    Many thanks from a .Net Newbie

  3. #43
    New Member
    Join Date
    Nov 12
    Posts
    3

    Re: ZoomPictureBox: picture control with mouse-centred zooming

    I am trying to add zoom features to my program and I am doing a fit to width and fit to height click options. I am getting the size working, but I am having no luck on moving the picture within the zoompicturebox on just the click. I am attempting to get it to the upper left corner. My research is showing that the picturebox would use sizemode, but as I am not inheriting from picturebox it is not present with zoompicturebox. So far I have not found a combination that does what I am trying to do. Any ideas?

    Thank you,
    newbie

  4. #44
    Frenzied Member boops boops's Avatar
    Join Date
    Nov 08
    Location
    Holland/France
    Posts
    1,983

    Re: ZoomPictureBox: picture control with mouse-centred zooming

    Try this:
    Code:
    ZoomPictureBox1.ImageLocation = Point.Empty
    Point.Empty is the same as Point(0,0). With a little bit of arithmetic with the widths and heights you should be able to work out how to centre the image if you need to.

    BB

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •