Class
Mouse

Mouse events class.

Definition

Namespace:ArtOfTest.WebAii.Win32

Assembly:ArtOfTest.WebAii.dll

Syntax:

cs-api-definition
public class Mouse

Inheritance: objectMouse

Fields

CLICK_DELAY

Default number of ms to hold the mouse down for when we click

Declaration

cs-api-definition
protected const int CLICK_DELAY = 50

Field Value

int

WHEEL_DELTA

Mouse wheel delta.

Declaration

cs-api-definition
protected const int WHEEL_DELTA = 120

Field Value

int

_desktop

The owner desktop object.

Declaration

cs-api-definition
protected Desktop _desktop

Field Value

Desktop

Properties

MouseMoveIntervalTime

Gets/Sets the mouse interval time between mouse move intervals. The default is set at 15msec. Typically you don't need to change this. If you want to configure the speed of the mouse move, use the Settings.SimulatedMouseMoveSpeed.

Declaration

cs-api-definition
public int MouseMoveIntervalTime { get; set; }

Property Value

int

Methods

CalculateOffset(Rectangle, Point, OffsetReference)

Calculates the offset from the rectangles given a reference.

Declaration

cs-api-definition
public static Point CalculateOffset(Rectangle rectangle, Point offset, OffsetReference reference)

Parameters

rectangle

Rectangle

The rectangle.

offset

Point

The offset.

reference

OffsetReference

The offset reference type.

Returns

Point

The adjusted point.

Click(MouseClickType, Point)

Simulate a mouse event (Target as a point object)

Declaration

cs-api-definition
public void Click(MouseClickType clickType, Point pointToClick)

Parameters

clickType

MouseClickType

The type of the click mouse to simulate.

pointToClick

Point

The point to click.

Click(MouseClickType, Rectangle)

Simulate a mouse event (Target a rectangle). Will click absolute center of target rectangle.

Declaration

cs-api-definition
public void Click(MouseClickType clickType, Rectangle target)

Parameters

clickType

MouseClickType

The type of the click mouse to simulate.

target

Rectangle

The target rectangle to click the center for.

Click(MouseClickType, Rectangle, Point, OffsetReference)

Simulate a mouse event (Target as a rectangle with offset)

Declaration

cs-api-definition
public void Click(MouseClickType clickType, Rectangle target, Point offset, OffsetReference reference)

Parameters

clickType

MouseClickType

The type of the click mouse to simulate.

target

Rectangle

The target rectangle.

offset

Point

The offset in X/Y (negatives represents opposite direction). For offset: Positive X : Represents the right direction. Negative X : Represents the left direction. Positive Y : Represents the down direction. Negative Y : Represents the up direction.

        Keep these in mind when calculating the offset from a reference point.
        </remarks>

reference

OffsetReference

The reference point to offset within the rectangle.

Click(MouseClickType, Rectangle, Point, OffsetReference, ActionPointUnitType)

Simulate a mouse event (Target as a rectangle with offset)

Declaration

cs-api-definition
public void Click(MouseClickType clickType, Rectangle target, Point offset, OffsetReference reference, ActionPointUnitType unitType)

Parameters

clickType

MouseClickType

The type of the click mouse to simulate.

target

Rectangle

The target rectangle.

offset

Point

The offset in X/Y (negatives represents opposite direction). When unit type is set to percentage X offset represents percentage of target width and Y offset represents percentage of target height For offset: Positive X : Represents the right direction. Negative X : Represents the left direction. Positive Y : Represents the down direction. Negative Y : Represents the up direction.

        Keep these in mind when calculating the offset from a reference point.
        </remarks>

reference

OffsetReference

The reference point to offset within the rectangle.

unitType

ActionPointUnitType

Offset unit type.

Click(MouseClickType, int, int)

Simulate a mouse event.

Declaration

cs-api-definition
public void Click(MouseClickType clickType, int x, int y)

Parameters

clickType

MouseClickType

The type of the click mouse to simulate.

x

int

Absolute X coordinate to click on.

y

int

Absolute Y coordinate to click on.

Click(MouseClickType, int, int, int)

Simulate a mouse event.

Declaration

cs-api-definition
protected virtual void Click(MouseClickType clickType, int x, int y, int wheelDelta)

Parameters

clickType

MouseClickType

The type of the click mouse to simulate.

x

int

Absolute X coordinate to click on.

y

int

Absolute Y coordinate to click on.

wheelDelta

int

If a Wheel click then the wheel's turn delta, else ignored

DetectHotSpot(Rectangle, Cursor, int)

Given a rectangle and optionally a cursor, this function will detect the cursor change

Declaration

cs-api-definition
public virtual Point DetectHotSpot(Rectangle rectangle, Cursor hotSpotCursor, int radius)

Parameters

rectangle

Rectangle

The rectangle to you to detect the host spot within.

hotSpotCursor

Cursor

The cursor that the hot spot will be. If null, the function will assume a hot spot if the cursor simple changes.

radius

int

The number of pixels from the center point to scan.

Returns

Point

The actual point the ended up activating the cursor change.

DragDrop(Point, Point)

Simulate a mouse drag and drop.

Declaration

cs-api-definition
public void DragDrop(Point start, Point end)

Parameters

start

Point

The start drag point.

end

Point

The end drop point.

DragDrop(Point, Point, int, int)

Simulate a mouse drag and drop.

Declaration

cs-api-definition
public void DragDrop(Point start, Point end, int intervals, int intervalDelay)

Parameters

start

Point

The start drag point.

end

Point

The end drop point.

intervals

int

Number of intervals for this dragdrop operation.

intervalDelay

int

The delay in msec. between each interval.

DragDrop(Rectangle, Point, OffsetReference, Rectangle, Point, OffsetReference)

Simulate a mouse drag and drop.

Declaration

cs-api-definition
public void DragDrop(Rectangle startTarget, Point startOffset, OffsetReference startReference, Rectangle endTarget, Point endOffset, OffsetReference endReference)

Parameters

startTarget

Rectangle

The start rectangle.

startOffset

Point

The start offset.

startReference

OffsetReference

The start offset reference.

endTarget

Rectangle

The end rectangle.

endOffset

Point

The end offset.

endReference

OffsetReference

The end offset reference.

DragDrop(Rectangle, Point, OffsetReference, Rectangle, Point, OffsetReference, int, int)

Simulate a mouse drag and drop.

Declaration

cs-api-definition
public void DragDrop(Rectangle startTarget, Point startOffset, OffsetReference startReference, Rectangle endTarget, Point endOffset, OffsetReference endReference, int intervals, int intervalDelay)

Parameters

startTarget

Rectangle

The start rectangle.

startOffset

Point

The start offset.

startReference

OffsetReference

The start offset reference.

endTarget

Rectangle

The end rectangle.

endOffset

Point

The end offset.

endReference

OffsetReference

The end offset reference.

intervals

int

Number of intervals for this dragdrop operation.

intervalDelay

int

The delay in msec. between each interval.

DragDrop(Rectangle, Rectangle)

Simulate a mouse drag and drop. (Uses center point of each rectangle)

Declaration

cs-api-definition
public void DragDrop(Rectangle start, Rectangle end)

Parameters

start

Rectangle

Start target.

end

Rectangle

End target.

DragDrop(Rectangle, Rectangle, int, int)

Simulate a mouse drag and drop. (Uses center point of each rectangle)

Declaration

cs-api-definition
public void DragDrop(Rectangle startTarget, Rectangle endTarget, int intervals, int intervalDelay)

Parameters

startTarget

Rectangle

Start target.

endTarget

Rectangle

End target.

intervals

int

Number of intervals for this dragdrop operation.

intervalDelay

int

The delay in msec. between each interval.

DragDrop(Rectangle, int, int, OffsetReference, Rectangle, int, int, OffsetReference)

Simulate a mouse drag and drop.

Declaration

cs-api-definition
public void DragDrop(Rectangle startTarget, int startOffsetX, int startOffsetY, OffsetReference startReference, Rectangle endTarget, int endOffsetX, int endOffsetY, OffsetReference endReference)

Parameters

startTarget

Rectangle

The start rectangle.

startOffsetX

int

The x start offset.

startOffsetY

int

The y start offset.

startReference

OffsetReference

The start offset reference.

endTarget

Rectangle

The end rectangle.

endOffsetX

int

The x end offset.

endOffsetY

int

The y end offset.

endReference

OffsetReference

The end offset reference.

DragDrop(Rectangle, int, int, OffsetReference, Rectangle, int, int, OffsetReference, int, int)

Simulate a mouse drag and drop.

Declaration

cs-api-definition
public void DragDrop(Rectangle startTarget, int startOffsetX, int startOffsetY, OffsetReference startReference, Rectangle endTarget, int endOffsetX, int endOffsetY, OffsetReference endReference, int intervals, int intervalDelay)

Parameters

startTarget

Rectangle

The start rectangle.

startOffsetX

int

The x start offset.

startOffsetY

int

The y start offset.

startReference

OffsetReference

The start offset reference.

endTarget

Rectangle

The end rectangle.

endOffsetX

int

The x end offset.

endOffsetY

int

The y end offset.

endReference

OffsetReference

The end offset reference.

intervals

int

Number of intervals for this dragdrop operation.

intervalDelay

int

The delay in msec. between each interval.

DragDrop(int, int, int, int)

Simulates a mouse drag and drop.

Declaration

cs-api-definition
public void DragDrop(int startX, int startY, int endX, int endY)

Parameters

startX

int

Absolute X coordinate to start the drag.

startY

int

Absolute Y coordinate to start the drag.

endX

int

Absolute X coordinate to do the drop.

endY

int

Absolute Y coordinate to do the drop.

DragDrop(int, int, int, int, int, int)

Simulates a mouse drag and drop.

Declaration

cs-api-definition
public virtual void DragDrop(int startX, int startY, int endX, int endY, int intervals, int intervalDelay)

Parameters

startX

int

Absolute X coordinate to start the drag.

startY

int

Absolute Y coordinate to start the drag.

endX

int

Absolute X coordinate to do the drop.

endY

int

Absolute Y coordinate to do the drop.

intervals

int

Number of intervals for this DragDrop operation.

intervalDelay

int

The delay in msec. between each interval.

GetCursorHandle()

Get the current cursor handle

Declaration

cs-api-definition
public virtual IntPtr GetCursorHandle()

Returns

IntPtr

The cursor handle.

Remarks

System.Windows.Forms.Cursor.Handle does not work. Seems like it is always cached.

GetDistance(Point, Point)

Gets the number of mouse move intervals depending on the current set speed and interval time. Any negative coordinates will be reset to zero automatically.

Declaration

cs-api-definition
protected float GetDistance(Point start, Point end)

Parameters

start

Point

The start point.

end

Point

The end point.

Returns

float

The distance.

GetRelativeNumOfMouseMoveIntervals(Point, Point)

Gets the number of mouse move intervals depending on the current set speed and interval time.

Declaration

cs-api-definition
protected int GetRelativeNumOfMouseMoveIntervals(Point start, Point end)

Parameters

start

Point

The start point.

end

Point

The end point.

Returns

int

return the number of intervals

GetRelativeNumOfMouseMoveIntervals(Rectangle, Point, OffsetReference, Rectangle, Point, OffsetReference)

Returns the relative number of mouse move intervals given a start/end locations.

Declaration

cs-api-definition
protected int GetRelativeNumOfMouseMoveIntervals(Rectangle startTarget, Point startOffset, OffsetReference startReference, Rectangle endTarget, Point endOffset, OffsetReference endReference)

Parameters

startTarget

Rectangle

Start rectangle.

startOffset

Point

Start offset.

startReference

OffsetReference

Start offset reference.

endTarget

Rectangle

End rectangle.

endOffset

Point

End offset.

endReference

OffsetReference

End offset reference.

Returns

int

The number of intervals

GetRelativeNumOfMouseMoveIntervals(Rectangle, Rectangle)

Gets the number of mouse move intervals depending on the current set speed and interval time. Uses the absolute centers of passed in rectangles.

Declaration

cs-api-definition
protected int GetRelativeNumOfMouseMoveIntervals(Rectangle start, Rectangle end)

Parameters

start

Rectangle

The start location.

end

Rectangle

The end location.

Returns

int

The number of intervals

GetRelativeNumOfMouseMoveIntervals(int)

Gets the number of mouse move intervals depending on the current set speed and interval time. DistanceInPixels(pixels) = NumOfIntervals(const) * IntervalTime(msec) * Speed(pixels/msec)

Declaration

cs-api-definition
protected int GetRelativeNumOfMouseMoveIntervals(int distanceInPixels)

Parameters

distanceInPixels

int

The distance in pixels.

Returns

int

The number of intervals.

HoverOver(Point)

HoverOver (Target a point).

Declaration

cs-api-definition
public void HoverOver(Point pointToHoverOver)

Parameters

pointToHoverOver

Point

Point to hover over.

HoverOver(Rectangle)

Hover over (Target the center of the target rectangle).

Declaration

cs-api-definition
public void HoverOver(Rectangle target)

Parameters

target

Rectangle

The target rectangle.

HoverOver(Rectangle, Point, OffsetReference)

Hover over (Target is a rectangle with an offset).

Declaration

cs-api-definition
public void HoverOver(Rectangle target, Point offset, OffsetReference reference)

Parameters

target

Rectangle

The target rectangle.

offset

Point

The offset in X/Y (negatives represents opposite direction).

reference

OffsetReference

The reference point to offset within the rectangle.

HoverOver(Rectangle, Point, OffsetReference, ActionPointUnitType)

Hover over (Target is a rectangle with an offset).

Declaration

cs-api-definition
public void HoverOver(Rectangle target, Point offset, OffsetReference reference, ActionPointUnitType unitType)

Parameters

target

Rectangle

The target rectangle.

offset

Point

The offset in X/Y (negatives represents opposite direction). When unit type is set to percentage X offset represents percentage of target width and Y offset represents percentage of target height.

reference

OffsetReference

The reference point to offset within the rectangle.

unitType

ActionPointUnitType

Offset unit type.

HoverOver(int, int)

Simulates a mouse hover over. Simply moves the mouse pointer over the X,Y passed in. Can also be used to move the mouse to a certain location.

Declaration

cs-api-definition
public void HoverOver(int x, int y)

Parameters

x

int

Absolute X coordinate to click.

y

int

Absolute Y coordinate to click.

MatchCursor(IntPtr)

Tests whether or not the current mouse handle matches a specified handle. Can be used to check if the current mouse cursor is a particular value.

Declaration

cs-api-definition
public bool MatchCursor(IntPtr handle)

Parameters

handle

IntPtr

The mouse handle to compare.

Returns

bool

True/False indicating whether or not the current mouse cursor handle matches.

Move(Point, Point)

Move the mouse from the start to the end location

Declaration

cs-api-definition
public void Move(Point start, Point end)

Parameters

start

Point

start point of the move.

end

Point

end point of the move

Move(Point, Point, int, int)

Move the mouse from the start to the end location

Declaration

cs-api-definition
public void Move(Point start, Point end, int intervals, int intervalDelay)

Parameters

start

Point

start point of the move.

end

Point

end point of the move

intervals

int

Number of intervals for this Move operation.

intervalDelay

int

The delay in msec. between each interval.

Move(Rectangle, Point, OffsetReference, Rectangle, Point, OffsetReference)

Move the mouse from the start to the end location

Declaration

cs-api-definition
public void Move(Rectangle startTarget, Point startOffset, OffsetReference startReference, Rectangle endTarget, Point endOffset, OffsetReference endReference)

Parameters

startTarget

Rectangle

Move start rectangle.

startOffset

Point

Move start offset.

startReference

OffsetReference

Move start offsetReference

endTarget

Rectangle

Move end rectangle.

endOffset

Point

Move end offset.

endReference

OffsetReference

Move end offsetReference.

Move(Rectangle, Point, OffsetReference, Rectangle, Point, OffsetReference, int, int)

Move the mouse from the start to the end location

Declaration

cs-api-definition
public void Move(Rectangle startTarget, Point startOffset, OffsetReference startReference, Rectangle endTarget, Point endOffset, OffsetReference endReference, int intervals, int intervalDelay)

Parameters

startTarget

Rectangle

Move start rectangle.

startOffset

Point

Move start offset.

startReference

OffsetReference

Move start offsetReference

endTarget

Rectangle

Move end rectangle.

endOffset

Point

Move end offset.

endReference

OffsetReference

Move end offsetReference.

intervals

int

Number of intervals for this Move operation.

intervalDelay

int

The delay in msec. between each interval.

Move(Rectangle, Rectangle)

Move the mouse from the start to the end location

Declaration

cs-api-definition
public void Move(Rectangle start, Rectangle end)

Parameters

start

Rectangle

Move start point.

end

Rectangle

Move end point.

Move(Rectangle, Rectangle, int, int)

Move the mouse from the start to the end location

Declaration

cs-api-definition
public void Move(Rectangle start, Rectangle end, int intervals, int intervalDelay)

Parameters

start

Rectangle

Move start point.

end

Rectangle

Move end point.

intervals

int

Number of intervals for this Move operation.

intervalDelay

int

The delay in msec. between each interval.

Move(Rectangle, int, int, OffsetReference, Rectangle, int, int, OffsetReference)

Move the mouse from the start to the end location

Declaration

cs-api-definition
public void Move(Rectangle startTarget, int startOffsetX, int startOffsetY, OffsetReference startReference, Rectangle endTarget, int endOffsetX, int endOffsetY, OffsetReference endReference)

Parameters

startTarget

Rectangle

Move start rectangle.

startOffsetX

int

Move start offset x.

startOffsetY

int

Move start offset y.

startReference

OffsetReference

Move start offsetReference

endTarget

Rectangle

Move end rectangle.

endOffsetX

int

Move end offset x.

endOffsetY

int

Move end offset y.

endReference

OffsetReference

Move end offsetReference.

Move(Rectangle, int, int, OffsetReference, Rectangle, int, int, OffsetReference, int, int)

Move the mouse from the start to the end location

Declaration

cs-api-definition
public void Move(Rectangle startTarget, int startOffsetX, int startOffsetY, OffsetReference startReference, Rectangle endTarget, int endOffsetX, int endOffsetY, OffsetReference endReference, int intervals, int intervalDelay)

Parameters

startTarget

Rectangle

Move start rectangle.

startOffsetX

int

Move start offset x.

startOffsetY

int

Move start offset y.

startReference

OffsetReference

Move start offsetReference

endTarget

Rectangle

Move end rectangle.

endOffsetX

int

Move end offset x.

endOffsetY

int

Move end offset y.

endReference

OffsetReference

Move end offsetReference.

intervals

int

Number of intervals for this Move operation.

intervalDelay

int

The delay in msec. between each interval.

Move(int, int, int, int)

Move the mouse from the start to the end location

Declaration

cs-api-definition
public void Move(int startX, int startY, int endX, int endY)

Parameters

startX

int

Move start X position.

startY

int

Move start Y position.

endX

int

Move end X position.

endY

int

Move end Y position.

Move(int, int, int, int, int, int)

Move the mouse from the start to the end location

Declaration

cs-api-definition
public void Move(int startX, int startY, int endX, int endY, int intervals, int intervalDelay)

Parameters

startX

int

Move start X position.

startY

int

Move start Y position.

endX

int

Move end X position.

endY

int

Move end Y position.

intervals

int

Number of intervals for this Move operation.

intervalDelay

int

The delay in msec. between each interval.

TurnWheel(int, MouseWheelTurnDirection)

Move the mouse wheel by a certain delta

Declaration

cs-api-definition
public void TurnWheel(int delta, MouseWheelTurnDirection direction)

Parameters

delta

int

The delta to use.

direction

MouseWheelTurnDirection

The direction to turn the mouse wheel in.

Extension Methods

In this article
DefinitionFieldsCLICK_DELAYWHEEL_DELTA_desktopPropertiesMouseMoveIntervalTimeMethodsCalculateOffset(Rectangle, Point, OffsetReference)Click(MouseClickType, Point)Click(MouseClickType, Rectangle)Click(MouseClickType, Rectangle, Point, OffsetReference)Click(MouseClickType, Rectangle, Point, OffsetReference, ActionPointUnitType)Click(MouseClickType, int, int)Click(MouseClickType, int, int, int)DetectHotSpot(Rectangle, Cursor, int)DragDrop(Point, Point)DragDrop(Point, Point, int, int)DragDrop(Rectangle, Point, OffsetReference, Rectangle, Point, OffsetReference)DragDrop(Rectangle, Point, OffsetReference, Rectangle, Point, OffsetReference, int, int)DragDrop(Rectangle, Rectangle)DragDrop(Rectangle, Rectangle, int, int)DragDrop(Rectangle, int, int, OffsetReference, Rectangle, int, int, OffsetReference)DragDrop(Rectangle, int, int, OffsetReference, Rectangle, int, int, OffsetReference, int, int)DragDrop(int, int, int, int)DragDrop(int, int, int, int, int, int)GetCursorHandle()GetDistance(Point, Point)GetRelativeNumOfMouseMoveIntervals(Point, Point)GetRelativeNumOfMouseMoveIntervals(Rectangle, Point, OffsetReference, Rectangle, Point, OffsetReference)GetRelativeNumOfMouseMoveIntervals(Rectangle, Rectangle)GetRelativeNumOfMouseMoveIntervals(int)HoverOver(Point)HoverOver(Rectangle)HoverOver(Rectangle, Point, OffsetReference)HoverOver(Rectangle, Point, OffsetReference, ActionPointUnitType)HoverOver(int, int)MatchCursor(IntPtr)Move(Point, Point)Move(Point, Point, int, int)Move(Rectangle, Point, OffsetReference, Rectangle, Point, OffsetReference)Move(Rectangle, Point, OffsetReference, Rectangle, Point, OffsetReference, int, int)Move(Rectangle, Rectangle)Move(Rectangle, Rectangle, int, int)Move(Rectangle, int, int, OffsetReference, Rectangle, int, int, OffsetReference)Move(Rectangle, int, int, OffsetReference, Rectangle, int, int, OffsetReference, int, int)Move(int, int, int, int)Move(int, int, int, int, int, int)TurnWheel(int, MouseWheelTurnDirection)Extension Methods
Not finding the help you need?
Contact Support