无边框windows窗体移动

来源:互联网 发布:2017年淘宝卖什么好 编辑:程序博客网 时间:2024/05/17 01:13
<span style="white-space:pre"></span>private int oldX = 0;        private int oldY = 0;        private void panel1_MouseMove(object sender, MouseEventArgs e)        {            if (e.Button == MouseButtons.Left)            {                this.Left += e.Location.X - this.oldX;                this.Top += e.Location.Y - this.oldY;            }        }        private void panel1_MouseDown(object sender, MouseEventArgs e)        {            if (e.Button == MouseButtons.Left)            {                this.oldX = e.Location.X;                this.oldY = e.Location.Y;            }        }

0 0