title: How to copy one Graphics Object into another
body: <p>I am trying to copy the contents of one graphics object to another, but the only was I have been able to find is based on using <code>GDI32.DLL</code>, which i would rather avoid using if possible.</p>
  
  <p>Does anyone know how/if this is possible using managed code?  I don't mind if answers are in C# or VB.Net.</p>
  
  <p>Here is what I currently have:</p>
  
  <pre class="lang-vb prettyprint-override"><code>Private Sub CopyGraphics()
      Dim srcPic As Graphics = pnl.CreateGraphics
  
      Dim srcBmp As New Bitmap(pnl.Width, pnl.Height, srcPic)
      Dim srcMem As Graphics = Graphics.FromImage(srcBmp)
  
      Dim HDC1 As IntPtr = srcPic.GetHdc
      Dim HDC2 As IntPtr = srcMem.GetHdc
  
      BitBlt(HDC2, 0, 0, pnl.Width, pnl.Height, HDC1, 0, 0, 13369376)
  
      pnlDraw.BackgroundImage = srcBmp
  
      'Clean Up code omitted...
  End Sub
  </code></pre>