返回提交历史
Modified
README.md
+1
-0
Modified
XFE各类拓展.NetCore.InputSimulator/InputSimulator.cs
+14
-6
Modified
XFE各类拓展.NetCore.InputSimulator/XFE各类拓展.NetCore.InputSimulator.csproj
+4
-2
XFEstudio/XFEExtension.NetCore.InputSimulator
新增鼠标滚轮操作,修改md文件,修改程序集版本
78a0041
代码差异
3 个文件
+19
-8
@@ -32,6 +32,7 @@ InputSimulator.LocateTo(ScreenPosition.TopLeft);//使得鼠标移动至屏幕的
32
32
using XFE各类拓展.NetCore.InputSimulator;
33
33
34
34
InputSimulator.MouseClick(MouseButton.Left);//模拟鼠标左键点击
35
InputSimulator.MouseWhellRoll(-800);//模拟鼠标滚轮下滑800像素
35
36
```
36
37
37
38
### 获取信息
@@ -12,7 +12,7 @@ public static partial class InputSimulator
12
12
[LibraryImport("user32.dll", SetLastError = true)]
13
13
private static partial void keybd_event(byte bVk, byte bScan, uint dwFlags, IntPtr dwExtraInfo);
14
14
[LibraryImport("user32.dll")]
15
private static partial void mouse_event(uint dwFlags, int dx, int dy, uint dwData, IntPtr dwExtraInfo);
15
private static partial void mouse_event(uint dwFlags, int dx, int dy, int dwData, IntPtr dwExtraInfo);
16
16
[LibraryImport("user32.dll")]
17
17
private static partial int GetSystemMetrics(int nIndex);
18
18
[LibraryImport("user32.dll")]
@@ -108,7 +108,7 @@ public static partial class InputSimulator
108
108
/// </remarks>
109
109
/// <param name="x">X偏移</param>
110
110
/// <param name="y">Y偏移</param>
111
public static void Move(int x, int y)
111
public static void MouseMove(int x, int y)
112
112
{
113
113
mouse_event(MOUSEEVENTF_MOVE, x, y, 0, IntPtr.Zero);
114
114
}
@@ -116,7 +116,7 @@ public static partial class InputSimulator
116
116
/// 将鼠标定位至
117
117
/// </summary>
118
118
/// <remarks>
119
/// 如果需要相对移动请使用<see cref="Move(int, int)"/>方法
119
/// 如果需要相对移动请使用<see cref="MouseMove(int, int)"/>方法
120
120
/// </remarks>
121
121
/// <param name="x">X坐标</param>
122
122
/// <param name="y">Y坐标</param>
@@ -128,7 +128,7 @@ public static partial class InputSimulator
128
128
/// 将鼠标定位至
129
129
/// </summary>
130
130
/// <remarks>
131
/// 如果需要相对移动请使用<see cref="Move(int, int)"/>方法
131
/// 如果需要相对移动请使用<see cref="MouseMove(int, int)"/>方法
132
132
/// </remarks>
133
133
/// <param name="point">定位到的位置</param>
134
134
public static void LocateTo(Point point)
@@ -139,7 +139,7 @@ public static partial class InputSimulator
139
139
/// 将鼠标定位至
140
140
/// </summary>
141
141
/// <remarks>
142
/// 如果需要相对移动请使用<see cref="Move(int, int)"/>方法
142
/// 如果需要相对移动请使用<see cref="MouseMove(int, int)"/>方法
143
143
/// </remarks>
144
144
/// <param name="screenPosition">屏幕空间位置</param>
145
145
public static void LocateTo(ScreenPosition screenPosition)
@@ -229,6 +229,14 @@ public static partial class InputSimulator
229
229
break;
230
230
}
231
231
}
232
/// <summary>
233
/// 鼠标滚轮滚动
234
/// </summary>
235
/// <param name="length">滚动长度,负为向下滚动</param>
236
public static void MouseWhellRoll(int length)
237
{
238
mouse_event(MOUSEEVENTF_WHEEL, GetMousePosition().X, GetMousePosition().Y, length, IntPtr.Zero);
239
}
232
240
#endregion
233
241
#region 系统信息获取方法
234
242
/// <summary>
@@ -255,7 +263,7 @@ public static partial class InputSimulator
255
263
public static (double X, double Y) GetMousePointRelatively()
256
264
{
257
265
GetCursorPos(out Point point);
258
return ((double)point.X / GetSystemMetrics(SM_CXSCREEN), (double)point.Y / GetSystemMetrics(SM_CYSCREEN));
266
return ((double)point.X / (GetSystemMetrics(SM_CXSCREEN) - 1), (double)point.Y / (GetSystemMetrics(SM_CYSCREEN) - 1));
259
267
}
260
268
#endregion
261
269
}
@@ -18,11 +18,13 @@
18
18
<PackageReadmeFile>README.md</PackageReadmeFile>
19
19
<RepositoryUrl>https://github.com/XFEstudio/XFEExtension.NetCore.InputSimulator</RepositoryUrl>
20
20
<PackageTags>XFE;拓展;键盘;按键;模拟输入;Input</PackageTags>
21
<PackageReleaseNotes>新增对模拟鼠标操作的支持</PackageReleaseNotes>
21
<PackageReleaseNotes>新增对鼠标滚轮操作的支持</PackageReleaseNotes>
22
22
<PackageLicenseFile>LICENSE</PackageLicenseFile>
23
23
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
24
<Version>1.0.1</Version>
24
<Version>1.1.0</Version>
25
25
<PackageIcon>logoIcon.png</PackageIcon>
26
<AssemblyVersion>1.1.5.0</AssemblyVersion>
27
<FileVersion>1.1.5.0</FileVersion>
26
28
</PropertyGroup>
27
29
28
30
<ItemGroup>