FormStartPosition.CenterParent does not work

前端 未结 13 910
独厮守ぢ
独厮守ぢ 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;
        }
    
    0 讨论(0)
提交回复
热议问题