Show a child form in the centre of Parent form in C#

后端 未结 19 1099
不思量自难忘°
不思量自难忘° 2020-11-28 08:21

I create a new form and call from the parent form as follows:

loginForm = new SubLogin();   
loginForm.Show();

I need to display the chi

19条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 08:54

    The setting of parent does not work for me unless I use form.ShowDialog();.

    When using form.Show(); or form.Show(this); nothing worked until I used, this.CenterToParent();. I just put that in the Load method of the form. All is good.

    Start position to the center of parent was set and does work when using the blocking showdialog.

提交回复
热议问题