winform无边框窗体拖动

时间:2021-06-19 19:10:18   收藏:0   阅读:0

#region 无边框窗体拖动

//获取当前鼠标坐标

private Point mPoint;

private void lbl_Title_MouseDown(object sender,MouseEventArgs e)

{

mPoint=e.Location;

}

private void lbl_Title_MouseMove(object sender,MouseEventArgs e)

{

//左键拖动

if(e.Button==MouseButtons.Left)

{

//窗体当前坐标

this.Locatin=new  Point(this.Location.X+e.X-mPoint.X,this.Location.y+e.Y-mPoint.Y);

}

}

#endregion

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!