C#窗体有个MouseMove事件,当鼠标在上面移动时触发,这里的事件参数可以获得该点的X轴和Y轴坐标。
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
label1.Text = "X:" + e.X.ToString() + " Y:" + e.Y.ToString();
}
}