well, it can be done in 2 ways
first, grab LocationChanged event of subform and dont let it go outside the main form's bounds.
second, add a Panel to your main form and add the subform in it but to do that you must set sub form's
TopLevel
property to false.
something like this
subform.TopLevel = false;
subform.Show();
panel1.Controls.Add(subform);