c# 如何记录鼠标按下和松开这两个事件的鼠标位置?
2个回答
展开全部
Point p;
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
p = new Point(e.X, e.Y); //按下
}
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
p = new Point(e.X, e.Y); //松开
}
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
p = new Point(e.X, e.Y); //按下
}
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
p = new Point(e.X, e.Y); //松开
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
int x, y;
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
x = e.X;
y = e.Y;
}
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
MessageBox.Show("鼠标按下坐标:" + x + "," + y + "\n鼠标释放坐标:" + e.X + "," + e.Y);
}
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
x = e.X;
y = e.Y;
}
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
MessageBox.Show("鼠标按下坐标:" + x + "," + y + "\n鼠标释放坐标:" + e.X + "," + e.Y);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询