当鼠标向下和向上时,我可以获得鼠标坐标
private void panel2_MouseDown(object sender, MouseEventArgs e)
{
mouseClickedX = e.X;
mouseClickedY = e.Y;
}
private void panel2_MouseUp(object sender, MouseEventArgs e)
{
mouseReleaseX = e.X;
mouseReleaseY = e.Y;
}
但是当鼠标按下并移动直到鼠标升起时,我需要连续的鼠标坐标。仅当鼠标移动时我不需要坐标,但是当鼠标按下并移动时我需要坐标。怎么做?
编辑:
private void panel2_MouseMove(object sender, MouseEventArgs e)
{
while (isDragging) {
mouseMoveX = e.X;
mouseMoveY = e.Y;
label1.Text = mouseMoveX.ToString();
label2.Text = mouseMoveY.ToString();
}
}
我正在使用 isDragging true 或 false onmosueup 和 down 但这只是挂起应用程序。我应该使用计时器还是线程?