title: c# screenshot of active window but doesn't caputre the window
body: <p>I'm creating an application in which I need to create a PDF file with the screenshot of the application. </p>
  
  <p>I found how to create the screenshot and how to put it in my file. All is working well in most situations. </p>
  
  <p>My problem comes when I use more than one screen or a programm like Teamviewer. The problem is, my programm captures the right area (good coordinates on the screen whenever which screen) but it captures all what's behind the window but not the window. </p>
  
  <p>Does somebody knows what am I doing wrong or if I missed a detail ? </p>
  
  <p>Here is the code I'm currently using :</p>
  
  <pre><code>// creates an rectangle of the size of the window
          Rectangle bounds = new Rectangle(
              (int)System.Windows.Application.Current.MainWindow.Left+10, 
              (int)System.Windows.Application.Current.MainWindow.Top+10, 
              (int)System.Windows.Application.Current.MainWindow.Width-20, 
              (int)System.Windows.Application.Current.MainWindow.Height-20);
  
          // creates a bitmap with a screenshot of the size of the window
          Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height);
          Graphics g = Graphics.FromImage(bitmap);
          g.CopyFromScreen(new System.Drawing.Point(bounds.Left, bounds.Top), new System.Drawing.Point(0,0), bounds.Size);
  </code></pre>
  
  <p>Thanks in advance for any help or examples. </p>