title: How to save a picturebox control as a jpeg file after it's edited
body: <p>I have a <code>PictureBox</code> on my Windows Forms application.</p>
  
  <p>I load a picture in it and I have enabled the <code>Paint</code> event in my code. It draws a rectangle.</p>
  
  <p>Like this:</p>
  
  <pre><code>private void pictureBox1_Paint(object sender, PaintEventArgs e)
  {
      Graphics gr = e.Graphics;
      Pen p = new Pen(Color.Red);
      p.Width = 5.0f;
      gr.DrawRectangle(p, 1, 2, 30, 40);
  }
  </code></pre>
  
  <p>And I click the "save" button:</p>
  
  <pre><code>private void button2_Click(object sender, EventArgs e)
  {
      pictureBox1.Image.Save(@"C:\Documents and Settings\tr1g3800\Desktop\WALKING\30P\100000test.jpg",ImageFormat.Jpeg);
  }
  </code></pre>
  
  <p>But the saved file never contains the rectangle that I drew.</p>
  
  <p>Does anyone have any idea?</p>