title: how to zoom at a point in picturebox in c#?
body: <p>This question is asked before but since it doesn't work and my lack of reputation point(I tried to comment at question but I couldn't) I had to ask this question again.</p>
  
  <p>This is the link of the quustion asked before;
  <a href="https://stackoverflow.com/questions/17895355/how-to-zoom-at-a-point-in-picturebox">How to zoom at a point in picturebox</a></p>
  
  <p>I used the code which is shown in the link but when I run it the point or shape disappear.</p>
  
  <p>here is my code;</p>
  
  <pre><code>public partial class Form1 : Form
  {
      private Matrix transform = new Matrix();     
      private double m_dZoomscale = 1.0;    
      public static double s_dScrollValue = .1;
   }
  private void pictureBox1_Paint(object sender, PaintEventArgs e)
      {
          Graphics g = e.Graphics;
          g.Transform = transform;
          Pen mypen = new Pen(Color.Red,5);
          Rectangle rect = new Rectangle(10, 10, 30, 30);
          e.Graphics.DrawRectangle(mypen, rect);
      }
      protected override void OnMouseWheel(MouseEventArgs mea)
      {
          pictureBox1.Focus();
          if (pictureBox1.Focused == true &amp;&amp; mea.Delta != 0)
          {
              ZoomScroll(mea.Location, mea.Delta &gt; 0);
          }
      }
        private void ZoomScroll(Point location, bool zoomIn)
      {
          transform.Translate(-location.X, -location.Y);
          if (zoomIn)
              transform.Scale((float)s_dScrollValue, (float)s_dScrollValue);
          else
              transform.Scale((float)-s_dScrollValue, (float)-s_dScrollValue);
  
          transform.Translate(location.X, location.Y);
  
          pictureBox1.Invalidate();
      }
  </code></pre>