how to zoom in using Mouse Position on that image
<p>I have a userControl library, which consists of the main Panel and a PictureBox, i want to make a zoomable PictureBox tool, i zoom in and out using mouseWheel event of the main Panel, the problem that i can't figure out how do i zoom in by the mouse position on the image,so whenever i zoom in, the zoom goes the Top-Left corner of the panel, so how do i fix that?</p>

<pre><code>private double ZOOMFACTOR = 1.15;   // = 15% smaller or larger
private int MINMAX = 5;
void picPanel_MouseWheel(object sender, MouseEventArgs e)
    {
        if (e.Delta &gt; 0)
        {
            ZoomIn();
        }
        else
        {
            ZoomOut();
        }
    }

    private void ZoomIn()
    {
        if ((picBox.Width &lt; (MINMAX * this.Width)) &amp;&amp;
            (picBox.Height &lt; (MINMAX * this.Height)))
        {
            picBox.Width = Convert.ToInt32(picBox.Width * ZOOMFACTOR);
            picBox.Height = Convert.ToInt32(picBox.Height * ZOOMFACTOR);
        }
    } 
    private void picBox_MouseEnter(object sender, EventArgs e)
    {
        if (picBox.Focused) return;
        picBox.Focus();
    }
</code></pre>

<p><strong>Update :</strong></p>

<p>I have tried this, it looks like working, but not exactly as it should be!! any ideas?</p>

<pre><code>    private void ZoomIn()
    {
        if ((picBox.Width &lt; (MINMAX * this.Width)) &amp;&amp;
            (picBox.Height &lt; (MINMAX * this.Height)))
        {
            picBox.Width = Convert.ToInt32(picBox.Width * ZOOMFACTOR);
            picBox.Height = Convert.ToInt32(picBox.Height * ZOOMFACTOR);

            Point p = this.AutoScrollPosition;
            int deltaX = e.X - p.X;
            int deltaY = e.Y - p.Y;
            this.AutoScrollPosition = new Point(deltaX, deltaY);
        }
    } 
</code></pre>
