NetAutoGUI.Windows/WindowsMouseController.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using NetAutoGUI.Internals;
using System;
using System.Runtime.Versioning;
using System.Threading;
using Vanara.PInvoke;
namespace NetAutoGUI.Windows
{
[SupportedOSPlatform("windows")]
internal class WindowsMouseController : AbstractMouseController
{
public override void Click(int? x = null, int? y = null, MouseButtonType button = MouseButtonType.Left, int clicks = 1, double interval = 0)
{
if (clicks <= 0)
{
throw new ArgumentOutOfRangeException(nameof(clicks), "clicks should be positive.");
}
TryMoveTo(x, y);
for (int i = 0; i < clicks; i++)
{
if (button == MouseButtonType.Left)
{
MouseHelper.LeftButtonClick();
}
else if (button == MouseButtonType.Middle)
{
MouseHelper.MiddleButtonClick();
}
else if (button == MouseButtonType.Right)
{
MouseHelper.RightButtonClick();
}
Thread.Sleep((int)(interval * 1000));
}
Thread.Sleep(100);
}
public override void MouseDown(int? x = null, int? y = null, MouseButtonType button = MouseButtonType.Left)
{
TryMoveTo(x, y);
if (button == MouseButtonType.Left)
{
MouseHelper.LeftButtonDown();
}
else if (button == MouseButtonType.Middle)
{
MouseHelper.MiddleButtonDown();
}
else if (button == MouseButtonType.Right)
{
MouseHelper.RightButtonDown();
}
}
public override void MouseUp(int? x = null, int? y = null, MouseButtonType button = MouseButtonType.Left)
{
TryMoveTo(x, y);
if (button == MouseButtonType.Left)
{
MouseHelper.LeftButtonUp();
后面还有 54 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。