Fork me on GitHub

窗体拖动不闪

 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);
            }
        }

 

posted on 2013-12-22 22:58  lingfeng95  阅读(335)  评论(0编辑  收藏  举报