Zoom into Tiff file

I am loading a tiff file into a PictureBox in .NET WinForms.
My users need to be able to zoom in and out of the image, do you have a function for this?

@mwbwc

Unfortunately, GroupDocs.Viewer itself does not offer built-in zoom functionality. Additionally, PictureBox controls also lack a native zoom feature. To achieve zooming, you’ll need to implement it within your client-side code.
We have basic Win Forms demo application that can only open files.

Thank you for sending me in the right direction.
I was able to get it working like this:

  1. Put the picturebox into a Panel (I named mine pnlPictureBox):
    a. Open the Form in design mode
    b. Cut the PictureBox
    c. Add a Panel, set AutoScroll to True
    d. Paste the PictureBox into the Panel

  2. On the PictureBox, set SizeMode = Forms.PictureBoxSizeMode.Zoom

  3. And here’s the code for zooming in:

    Private Sub LoadFile(ByVal fileName As String, PageNumber As Integer)
            tiffViewer = New Viewer(fileName)
            MemoryPageStreamFactory = New MemoryPageStreamFactory()
            jpgViewOptions = New JpgViewOptions(MemoryPageStreamFactory)
            tiffViewer.View(jpgViewOptions, PageNumber)
            MemoryPageStreamFactory.Stream.Position = 0
            pictureBox.Image = System.Drawing.Image.FromStream(MemoryPageStreamFactory.Stream) 

            ' These 2 lines are essential for zooming in/out
            pictureBox.Width = pictureBox.Image.Width
            pictureBox.Height = pictureBox.Image.Height
    End Sub
    Private Sub btnLarger_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLarger.Click
            pictureBox.Width += pictureBox.Width * 0.25
            pictureBox.Height += pictureBox.Height * 0.25
    End Sub

@mwbwc

You’re welcome! Thank you for adding the details and code snippet.