想要实现鼠标指针从A点缓慢移动到B点,请问有何思路?

解决方案 »

  1.   

    [DllImport( "user32.dll ",   EntryPoint   =   "SetCursorPos ",   CharSet   =   CharSet.Auto)] 
    static   extern   bool   SetCursorPos(int   X,int   Y); 
    timer中设置
      

  2.   

    1+1=?
    dylike问这么简单的问题?还是我没理解对?
      

  3.   

    是这样的,我的思路是用三角函数来实现鼠标的移动,比如鼠标从A点一点点移动到B点.但我数学不好.所以上来求助了.鼠标移动用cursor.posion就可以,主要是实现一点点移动,也就是每个点的坐标计算....
      

  4.   

    斜边每次步进长度定义为step,移动角度假设为r则
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim r As Double = 30 * Math.PI / 180
    Dim s As Double = 5
    Dim dx As Double = Math.Cos(r) * s
    Dim dy As Double = Math.Sin(r) * s While TextBox1.Left < Me.Width And TextBox1.Top < Me.Height
    TextBox1.Left += dx
    TextBox1.Top += dy
    Application.DoEvents()
    Thread.Sleep(20)
    End While
    MessageBox.Show("move done")
    TextBox1.Location = New Point(12, 12)
    End Sub
      

  5.   

    for 循环Cursor.Poistion = new Point(x, y);