title: Saving a drawing in C#
body: <p>I am trying to make a paint application in windows Forms (C#). It has different tabs and there is a pictureBox in one tab which acts as my drawing surface. I am saving the image by copying from screen using the following code :         </p>
  
  <pre><code>Bitmap bmpz = new Bitmap(pictureBox1.Width, pictureBox1.Height);
  Graphics gSaveAs = Graphics.FromImage(bmpz);
  Rectangle rectSaveAs = pictureBox1.RectangleToScreen(pictureBox1.ClientRectangle);
  gSaveAs.CopyFromScreen(rectSaveAs.Location, Point.Empty, pictureBox1.Size);
  </code></pre>
  
  <p>Is there a better way to save the drawing? The above method produces an image but need not be same as the one drawn. For eg, if I have a pop up or something on top of the picturebox, then the saved image will also have a pop up in it. How can I save just what is drawn on the screen? </p>