我的意思就是当鼠标在form中移动时,比如说鼠标从form窗口的上部移动到下部,我想获得从上部到下部这中间鼠标移动时所经过的每个相对于form的点坐标。
请问如何实现?

解决方案 »

  1.   

    Private Sub Form1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
            Debug.WriteLine(e.X)
            Debug.WriteLine(e.Y)
        End Sub
      

  2.   

    同意SysPlus(万诱引力),你说的完全正确
    MouseMove是鼠标移过指针时发生
      

  3.   

    SysPlus(万诱引力),写的是VB的代码吧,但是我也看出点东西了,可是我写完后,当鼠标在form1里移动时,状态栏不显示坐标值啊,请问如何修改?代码如下:        private void Form1_MouseMove(object sender, EventArgs e)
            {
                toolStripStatusLabel1.Text = "X:" + Form1.MousePosition.X + "  Y:" + Form1.MousePosition.Y;
               
            }
      

  4.   

    private void Form1_MouseMove(object sender, EventArgs e)
            {
                toolStripStatusLabel1.Text = "X:" + E.X + "  Y:" + E.Y;
               
            }
      

  5.   

    状态栏是不能用form的mousemove来得到其坐标的.
    不过你要得到整个屏幕中的坐标可以用Cursor.Position.X和Cursor.Position.Y