I create a new form and call from the parent form as follows:
loginForm = new SubLogin();
loginForm.Show();
I need to display the chi
If you want to calculate your own location, then first set StartPosition
to FormStartPosition.Manual
:
Form Child = new Form();
Child.StartPosition = FormStartPosition.Manual;
Child.Location = new Point(Location.X + (Width - Child.Width) / 2, Location.Y + (Height - Child.Height) / 2);
Child.Show(this);
Where this is the main/parent form, just like Location.X.
Default value for StartPosition
is FormStartPosition.CenterParent
and therefore it changes the child's location after showing.