c#事件,在窗体内按住鼠标拖动窗体的代码
代码:privatevoidLogin_MouseDown(objectsender,MouseEventArgse){start=Control.MousePositi...
代码:private void Login_MouseDown(object sender, MouseEventArgs e)
{
start = Control.MousePosition;
locat = this.Location;
}
private void Login_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Point temp = Control.MousePosition;
this.Location = new Point(locat.X + temp.X - start.Y, locat.X + temp.Y - start.Y);
}
}
这个在拖动的时候最开始窗体总会跳一下然后才正常,怎么改代码?? 展开
{
start = Control.MousePosition;
locat = this.Location;
}
private void Login_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Point temp = Control.MousePosition;
this.Location = new Point(locat.X + temp.X - start.Y, locat.X + temp.Y - start.Y);
}
}
这个在拖动的时候最开始窗体总会跳一下然后才正常,怎么改代码?? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询