窗体拖动事件

窗体拖动不闪

 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);
            }
        }
原文地址:https://www.cnblogs.com/zhao123/p/3486700.html