I have this code:
If e.Delta <> 0 Then
If e.Delta <= 0 Then
If PictureBox1.Width < 500 Then Exit Sub 'minimum 500?
Else
If PictureBox1.Width > 2000 Then Exit Sub 'maximum 2000?
End If
PictureBox1.Size = New System.Drawing.Size(PictureBox1.Width + e.Delta / 1, PictureBox1.Height + e.Delta / 1)
PictureBox1.Location = New Point(Control.MousePosition.X - PictureBox1.Width / 2, Control.MousePosition.Y - PictureBox1.Height / 2)
End If
which zooms the PictureBox to the center of the cursor location, but when I insert the picturebox to a panel, the image does not properly zoom in to the center of the image, instead to the edge of the panel.
How would I fix this?