This question is related to another question of mine which can be found here can be found here. I wanted to move a PictureBox within its parent container which
you can move the box unconditionally (no testing of the current location) and have a limitation for your new location:
int nx = Math.Min(Math.Max(pictureBoxPackageView.Left + (e.X -start.X),0),pictureBoxPackageView.Parent.Width-pictureBoxPackageView.Width);
int ny = Math.Min(Math.Max(pictureBoxPackageView.Top + (e.Y -start.Y),0),pictureBoxPackageView.Parent.Height-pictureBoxPackageView.Height);
pictureBoxPackageView.Location = new Point(nx,ny);