Fork me on GitHub

C#(winform)设置窗体的启动位置

只需要设置窗体的StartPosition属性:

registerForm.StartPosition = FormStartPosition.CenterScreen;

 

FormStartPosition的全部枚举值:

成员名称       说明
CenterParent ---------窗体在其父窗体中居中。
CenterScreen ---------窗体在当前显示窗口中居中,其尺寸在窗体大小中指定。 
Manual --------------窗体的位置由  Location 属性确定。 
WindowsDefaultBounds-------- 窗体定位在 Windows 默认位置,其边界也由 Windows 默认决定。 
WindowsDefaultLocation ------窗体定位在 Windows 默认位置,其尺寸在窗体大小中指定。

posted @ 2022-05-25 09:19  -悟空  阅读(2025)  评论(0)    收藏  举报