FormStartPosition.CenterParent does not work

前端 未结 13 978
独厮守ぢ
独厮守ぢ 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:00

    I found setting the location manually is the only reliable option in some more complex cases when form is auto-sized and dynamically modified.

    However rather than computing the coordinates manually, I'd suggest using existing method:

    this.CenterToParent();
    

提交回复
热议问题