窗体拖动事件

窗体拖动不闪

 private void Panel_MouseDown(object sender, MouseEventArgs e)

        {

            mousePoint = new Point(e.X,e.Y);

        }



        private void Panel_MouseMove(object sender, MouseEventArgs e)

        {

            if (e.Button == MouseButtons.Left)

            {

                //this.SetBounds(this.Location.X + e.X - mousePoint.X, this.Location.Y + e.Y - mousePoint.Y, this.Width, this.Height);

                this.SetBounds(this.Location.X + e.X - mousePoint.X, this.Location.Y + e.Y - mousePoint.Y, this.Width, this.Height);

                //this.SetBounds(this.Location.X + e.X, this.Location.Y + e.Y , this.Width, this.Height);

            }

        }

 

你可能感兴趣的:(事件)