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

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

registerForm.StartPosition = FormStartPosition.CenterScreen;

 

FormStartPosition的全部枚举值:

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

 

 

 

 

 

 

 

 

更详细的说明可以看:微软的官方文档

posted @ 2015-02-04 15:03  一菲聪天  阅读(6551)  评论(0编辑  收藏  举报