ColinOL

A Small Website

用户工具

站点工具


wiki:csharp:base-mnsbdj

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

wiki:csharp:base-mnsbdj [2018/02/04 04:42] (当前版本)
行 1: 行 1:
 +====== 模拟鼠标点击 ======
 +<code csharp>
 +[System.Runtime.InteropServices.DllImport("​user32"​)]
 +static extern void mouse_event(MouseEventFlag flags, int dx, int dy, uint data, UIntPtr extraInfo);
 +[Flags]
 +enum MouseEventFlag : uint
 +{
 +    Move = 0x0001,
 +    LeftDown = 0x0002,
 +    LeftUp = 0x0004,
 +    RightDown = 0x0008,
 +    RightUp = 0x0010,
 +    MiddleDown = 0x0020,
 +    MiddleUp = 0x0040,
 +    XDown = 0x0080,
 +    XUp = 0x0100,
 +    Wheel = 0x0800,
 +    VirtualDesk = 0x4000,
 +    Absolute = 0x8000
 +}
  
 +private void btnTestMoustClick_Click(object sender, EventArgs e)
 +{
 +   ​mouse_event(MouseEventFlag.LeftDown | MouseEventFlag.LeftUp,​ 20, 20, 0, UIntPtr.Zero);​
 +}
 +
 +</​code>​
wiki/csharp/base-mnsbdj.txt · 最后更改: 2018/02/04 04:42 (外部编辑)