FormStartPosition.CenterParent does not work

前端 未结 13 1026
独厮守ぢ
独厮守ぢ 2021-01-01 08:57

In the following code, only the second method works for me (.NET 4.0). FormStartPosition.CenterParent does not center the child form over its parent. Why?

13条回答
  •  忘掉有多难
    2021-01-01 10:04

    just put the code in the constructor of your form.

        public FrmSample()
        {
            InitializeComponent();
    
            // must be after the InitializeComponent()
            this.StartPosition = FormStartPosition.CenterParent;
        }
    

提交回复
热议问题