I need to show a form exactly in front of another form, this lead me to the following question.
How come a form can have a start position as CenterParent
while having the field this.Parent
equals to null?
It must know the parent in order to position itself correctly, which it does, but the Parent
field is not set. This is odd. Am I missing something?
Form2 f = new Form2();
f.ShowDialog();
Thats all I do on the child form. The parent is set to default windows position. No matter where I move the parent form, the child is shown in the center of the parent.
ShowDialog()
which accepts anIWin32Window
, otherwise the dialog form might appear behind your main form which confuses the user when they try to interact with your application but can’t. @Me.Name, no, see the top answer, only a focused window in the current app will ever become the owner. – Hartshorn