winform groupbox控件放到窗体中间位置

1、 在Form中放一个控件,让其在启动时始终居中

int gLeft = this.Width / 2 - groupControl1.Width / 2;

int gTop = this.Height / 2 - groupControl1.Height / 2;

groupControl1.Location = new Point(gLeft, gTop);、

 

2、在设计界面时,先把groupbox控件放到窗体中间位置,然后anchor属性 设置为none 即可

posted @ 2015-01-26 15:04  跟着阿笨一起玩.NET  阅读(4625)  评论(0编辑  收藏  举报