winform 窗口点击窗体任意位置移动窗体

        private bool _isDown;
private Point _mousePoint;
private void Users_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left) _isDown = true;
_mousePoint = new Point(-e.X, -e.Y);
} private void Users_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left) _isDown = false;
} private void Users_MouseMove(object sender, MouseEventArgs e)
{
if (!_isDown) return;
var wz = Control.MousePosition;
wz.Offset(_mousePoint);
Location = wz;
}
上一篇:记录一次cefsharp1输入法在win7下异常解决定位


下一篇:bzoj 1040 骑士