XFEExtension.NetCore.InputSimulator 2.3.0

dotnet add package XFEExtension.NetCore.InputSimulator --version 2.3.0                
NuGet\Install-Package XFEExtension.NetCore.InputSimulator -Version 2.3.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XFEExtension.NetCore.InputSimulator" Version="2.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XFEExtension.NetCore.InputSimulator --version 2.3.0                
#r "nuget: XFEExtension.NetCore.InputSimulator, 2.3.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install XFEExtension.NetCore.InputSimulator as a Cake Addin
#addin nuget:?package=XFEExtension.NetCore.InputSimulator&version=2.3.0

// Install XFEExtension.NetCore.InputSimulator as a Cake Tool
#tool nuget:?package=XFEExtension.NetCore.InputSimulator&version=2.3.0                

XFEExtension.NetCore.InputSimulator

简介

InputSimulator是一个简单的模拟键盘输入的包,其中包含了模拟键盘按键输入和鼠标输入

用法

模拟键盘输入

using XFEExtension.NetCore.InputSimulator;

InputSimulator.PressKey('X');//按下X按键
InputSimulator.InputKeys("XFE");//顺序按下 X、F、E 按键

模拟鼠标移动

using XFEExtension.NetCore.InputSimulator;

InputSimulator.Move(100, 100);//使得鼠标从当前位置相对移动 100 x 100 个像素(相对于鼠标指针的当前位置)
InputSimulator.LocateTo(1900, 202);//使得鼠标移动至绝对坐标 1900,202 的位置处(相对于整个屏幕的位置)
InputSimulator.LocateTo(new Point(0, 0));//使得鼠标移动至绝对坐标(0, 0)的位置处(相对于整个屏幕的位置)
InputSimulator.LocateTo(ScreenPosition.TopLeft);//使得鼠标移动至屏幕的左上角,即(0, 0)的位置处(相对于整个屏幕的位置)

模拟鼠标点击

using XFEExtension.NetCore.InputSimulator;

InputSimulator.MouseClick(MouseButton.Left);//模拟鼠标左键点击
InputSimulator.MouseWhellRoll(-800);//模拟鼠标滚轮下滑800像素

获取信息

using XFEExtension.NetCore.InputSimulator;

var screenSize = GetScreenSize();//获取屏幕的宽和高(像素)
var mousePoint = GetMousePosition();//获取鼠标的位置
var percentage = GetMousePointRelatively();//获取鼠标相对于屏幕的比值(范围是0-1的double型百分比)
var isLeftMouseDown = GetMouseDown(MouseButton.Left);//获取鼠标左键是否被按下
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.3.0 76 10/17/2024
2.2.0 109 8/5/2024
2.1.0 110 5/12/2024
2.0.0 140 3/7/2024

新增获取屏幕绝对大小和屏幕缩放倍率方法