title: How to zoom picturebox along with graphics
body: <p>I want to zoom picture box along with graphics.</p>
  
  <p>this will Zoom the only image part not the graphics part.</p>
  
  <pre><code>public Image PictureBoxZoom(Image imgP, Size size)
  {
      Bitmap bm = new Bitmap(imgP, Convert.ToInt32(imgP.Width * size.Width), Convert.ToInt32(imgP.Height * size.Height));
      Graphics grap = Graphics.FromImage(bm);
      grap.InterpolationMode = InterpolationMode.HighQualityBicubic;
      return bm;
  }
  
  private void zoomSlider_Scroll(object sender, EventArgs e)
  {
      if (zoomSlider.Value &gt; 0 &amp;&amp; img != null)
      {
          pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
          pictureBox1.Image = null;
          pictureBox1.Image = PictureBoxZoom(img, new Size(zoomSlider.Value, zoomSlider.Value));
      }
  }
  </code></pre>
  
  <p>the source of image is:</p>
  
  <pre><code>img = Image.FromStream(openFileDialog1.OpenFile());
  </code></pre>
  
  <p>Picture is zooming but when we draw the rectangle outside image then it's not zooming along with image.</p>
  
  <p>See image:</p>
  
  <p><a href="https://i.stack.imgur.com/KxAN2.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KxAN2.jpg" alt="enter image description here"></a></p>