System.Windows.Forms.Cursor.Position.X=100;
System.Windows.Forms.Cursor.Position.Y=100;

解决方案 »

  1.   

    同意 alron(*落花有意随流水,而流水无心恋落花*) 的写法
      

  2.   

    无法修改“System.Windows.Forms.Cursor.Position”的返回值,因为它不是变量?
      

  3.   

    yes,System.Windows.Forms.Cursor.Position是只读的
      

  4.   

    System.Windows.Forms.Cursor.Position是property
    试试这样写:
    System.Windows.Forms.Cursor.Position=new point(100,100);
      

  5.   

    [DllImport("User32.dll")]
    public static extern bool SetCursorPos(int x,int y);//定位鼠标的位置 private void menuItem3_Click(object sender, System.EventArgs e)
    {
       SetCursorPos(100,100);
    }
      

  6.   

    不好意思,上面粘得有些随意了(与什么menuItem3_Click无关)
    更正如下:
    using using System.Runtime.InteropServices;[DllImport("User32.dll")]
    public static extern bool SetCursorPos(int x,int y);//定位鼠标的位置在使用的时候
    SetCursorPos(100,100);
    就OK了