Пример #1
0
        /// <summary>
        /// 控件居中
        /// </summary>
        /// <param name="e"></param>
        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);
            FormHelp.ControlsToXCenter(this, this.groupBox2);

            /* //解决窗体第一次设置为最大化后,点击最大化按钮窗体无法居中问题
             * int x = Convert.ToInt32((Screen.PrimaryScreen.WorkingArea.Width - this.Width) * 0.5);
             * int y = Convert.ToInt32((Screen.PrimaryScreen.WorkingArea.Height - this.Height) * 0.5);
             * this.SetBounds(x, y, this.Width, this.Height, BoundsSpecified.All);*/
        }