add middle button click. Test passed #154

This commit is contained in:
辉鸭蛋 2024-05-03 22:22:06 +08:00
parent 98b744f33f
commit f1c82f83b0
2 changed files with 36 additions and 0 deletions

View File

@ -18,6 +18,14 @@ public interface IMouseSimulator
public IMouseSimulator LeftButtonDoubleClick();
public IMouseSimulator MiddleButtonDown();
public IMouseSimulator MiddleButtonUp();
public IMouseSimulator MiddleButtonClick();
public IMouseSimulator MiddleButtonDoubleClick();
public IMouseSimulator RightButtonDown();
public IMouseSimulator RightButtonUp();

View File

@ -72,6 +72,34 @@ public class MouseSimulator : IMouseSimulator
return this;
}
public IMouseSimulator MiddleButtonDown()
{
User32.INPUT[] inputList = new InputBuilder().AddMouseButtonDown(MouseButton.MiddleButton).ToArray();
SendSimulatedInput(inputList);
return this;
}
public IMouseSimulator MiddleButtonUp()
{
User32.INPUT[] inputList = new InputBuilder().AddMouseButtonUp(MouseButton.MiddleButton).ToArray();
this.SendSimulatedInput(inputList);
return this;
}
public IMouseSimulator MiddleButtonClick()
{
User32.INPUT[] inputList = new InputBuilder().AddMouseButtonClick(MouseButton.MiddleButton).ToArray();
SendSimulatedInput(inputList);
return this;
}
public IMouseSimulator MiddleButtonDoubleClick()
{
User32.INPUT[] inputList = new InputBuilder().AddMouseButtonDoubleClick(MouseButton.MiddleButton).ToArray();
SendSimulatedInput(inputList);
return this;
}
public IMouseSimulator RightButtonDown()
{
User32.INPUT[] inputList = new InputBuilder().AddMouseButtonDown(MouseButton.RightButton).ToArray();