C# 鼠标单击

时间:2022-04-29 09:54:22
【文件属性】:

文件名称:C# 鼠标单击

文件大小:1KB

文件格式:CS

更新时间:2022-04-29 09:54:22

window 鼠标单击 winfor

winform 鼠标单击帮助类 using System; using System.Collections.Generic; //using System.Linq; using System.Text; using System.Runtime.InteropServices; namespace Common { public class MouseAPI { public void MouseApi() { //构造函数 } [DllImport("user32.dll")] 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 } public bool ZClick() { bool _bo = false; try { mouse_event(MouseEventFlag.LeftDown, 0, 0, 0, UIntPtr.Zero); mouse_event(MouseEventFlag.LeftUp, 0, 0, 0, UIntPtr.Zero); _bo = true; } catch (Exception) { _bo = false; } return _bo; } } }


网友评论