您的位置:首页 > 其它

Winfrom窗体在去掉窗体边框的情况下使鼠标移动窗体

2015-11-17 11:11 337 查看
1添加鼠标移动上去事件

扑捉新的坐标

Point downPoint;(提供有序的 x 坐标和 y 坐标整数对,该坐标对在二维平面中定义一个点。)

private void FrmLogin_MouseMove(object sender, MouseEventArgs e)

{

if (e.Button == MouseButtons.Left)

{

this.Location = new Point(this.Location.X + e.X - downPoint.X,

this.Location.Y + e.Y - downPoint.Y);

}

}

2添加按下鼠标事件

private void FrmLogin_MouseDown(object sender, MouseEventArgs e)

{

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

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: