The following code will draw an Image on a PictureBox in the same spot relative to the containing Panel regardless of the location of the PictureBox:
vb.net Code:
Private Sub PictureBox1_Paint(ByVal sender As Object, _
ByVal e As PaintEventArgs) Handles PictureBox1.Paint
Dim imageLocation As New Point(10, 10)
'Translate the image location from Panel coordinates to PictureBox coordinates.
imageLocation = Me.PictureBox1.PointToClient(Me.Panel1.PointToScreen(imageLocation))
'Draw the image.
e.Graphics.DrawImage(My.Resources.OverlayImage, imageLocation)
End Sub
So, we first create a Point relative to the Panel. We then call the Panel's PointToScreen method, which returns the same Point relative to the entire screen. We then pass that result to the PictureBox's PointToClient method, which returns the same Point relative to the PictureBox. You then use that Point to draw the Image on the PictureBox and it will appear at (10, 10) relative to the Panel.