title: visual studio 2017 form location doesn't match picturebox location:
body: <p><em>I want to place a picturebox based on the location of the form, so I can move the form around and the box will stay in the same place.
  However, when setting the location of the picturebox to be equal to the location of the form, as I move the form, the picturebox change location within the form.
  <a href="https://i.stack.imgur.com/WIYxH.jpg" rel="nofollow noreferrer">Image 1</a>
  <a href="https://i.stack.imgur.com/OSfwi.jpg" rel="nofollow noreferrer">Image 2</a>
  You'll notice in the first image, the picturebox is close to the topleft corner of the form.  This is what I expect.
  When the form moves away from the corner of the screen, the picturebox moves in a similar manner.
  The code relevant to this is as follows.
   PictureBox2.Location = New Point(Me.Location.X, Me.Location.Y)
  How can I set the location of the picturebox to be in the same place on the form.
  <strong>Further Details:</strong>
  Before you ask: why not make them definite values, this isn't the actual implementation that I'm after.
  I'm running an OCR and using a transparent picturebox as my image capture window.  However, it wont line up correctly due to the above issue.
  The code used to get the image is
          gfx.CopyFromScreen(New Point(Me.Location.X + PictureBox1.Location.X + 100, Me.Location.Y + PictureBox1.Location.Y + 50), New Point(0, 0), pic.Size)
  However, as I move the form, the image taken is never the same relative location from the form location.</em></p>
  
  <p><strong>Edit: Attempt 2</strong>
  Ignore my previous question as I asked it badly.  Hopefully this attempt is better.  </p>
  
  <p><a href="https://i.stack.imgur.com/mgcRZ.jpg" rel="nofollow noreferrer">Image 3</a></p>
  
  <p>Image 3 shows ideally what I want the form to look like.  The top box of the form is  transparent picturebox1.  When I click the update button, I want to to take a screen shot of that picturebox1 location, and then fill a second picturebox2 below. This is what the image shows.</p>
  
  <p>However, if I move the form to the around, you get the following.</p>
  
  <p><a href="https://i.stack.imgur.com/NZHiZ.jpg" rel="nofollow noreferrer">Image4</a></p>
  
  <p>You can see here the 'photo' taken that is now in picturebox2 no longer lines up perfectly, but instead the image that has been taken is offset. </p>
  
  <p>I want the image captured to always be in the same location as the picturebox1.</p>
  
  <p>The only code being run when the picture is taken is the following.</p>
  
  <pre><code>gfx.CopyFromScreen(New Point(Me.Location.X + PictureBox1.Location.X + 100, Me.Location.Y + PictureBox1.Location.Y + 50), New Point(0, 0), pic.Size)
  
  PictureBox2.Image = pic
  </code></pre>
  
  <p>And the code at the start of the project is</p>
  
  <pre><code>    Dim pic As Bitmap = New Bitmap(270, 100)
  Dim gfx As Graphics = Graphics.FromImage(pic)
  </code></pre>
  
  <p>As the picturebox1 location is constant due to being a relative value to the form corner, the only values that are changing are me.location.x/y.<br>
  Therefore, it seems to me that the actual form moves further than the location.x/y value updates.</p>
  
  <p>Why is that and how can I fix my problem?</p>