熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

C# 鼠標移動到指定位置,並且單擊

2013-11-13 10:32:24  來源: .NET編程 

  [DllImport(User)] public extern static void mouse_event(int dwFlags int dx int dy int dwData IntPtr dwExtraInfo)[DllImport(userdll)] static extern bool SetCursorPos(int X int Y)

  public enum MouseEventFlags { Move = xLeftDown = xLeftUp = xRightDown = xRightUp = xMiddleDown = xMiddleUp = xWheel = xAbsolute = x } private void button_Click(object sender EventArgs e)

  { SetCursorPos( //用屏幕取點工具可以得到坐標mouse_event((int)(MouseEventFlagsLeftDown | MouseEventFlagsAbsolute) IntPtrZero)mouse_event((int)(MouseEventFlagsLeftUp | MouseEventFlagsAbsolute) IntPtrZero)}


From:http://tw.wingwit.com/Article/program/net/201311/13947.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.