Table of Contents

Class MouseEvent

Namespace
AngleSharp.Html.Dom.Events
Assembly
AngleSharp.dll

Represents the event args for a mouse event.

[DomName("MouseEvent")]
public class MouseEvent : UiEvent
Inheritance
MouseEvent
Derived
Inherited Members
Extension Methods

Constructors

MouseEvent()

Creates a new event.

public MouseEvent()

MouseEvent(string, bool, bool, IWindow?, int, int, int, int, int, bool, bool, bool, bool, MouseButton, IEventTarget?)

Creates a new event and initializes it.

[DomConstructor]
[DomInitDict(1, true)]
public MouseEvent(string type, bool bubbles = false, bool cancelable = false, IWindow? view = null, int detail = 0, int screenX = 0, int screenY = 0, int clientX = 0, int clientY = 0, bool ctrlKey = false, bool altKey = false, bool shiftKey = false, bool metaKey = false, MouseButton button = MouseButton.Primary, IEventTarget? relatedTarget = null)

Parameters

type string

The type of the event.

bubbles bool

If the event is bubbling.

cancelable bool

If the event is cancelable.

view IWindow

Sets the associated view for the UI event.

detail int

Sets the detail id for the UI event.

screenX int

Sets the screen X coordinate.

screenY int

Sets the screen Y coordinate.

clientX int

Sets the client X coordinate.

clientY int

Sets the client Y coordinate.

ctrlKey bool

Sets if the control key was pressed.

altKey bool

Sets if the alt key was pressed.

shiftKey bool

Sets if the shift key was pressed.

metaKey bool

Sets if the meta key was pressed.

button MouseButton

Sets which button has been pressed.

relatedTarget IEventTarget

The target of the mouse event.

Properties

Button

Gets which button has been pressed.

[DomName("button")]
public MouseButton Button { get; }

Property Value

MouseButton

Buttons

Gets the currently pressed buttons.

[DomName("buttons")]
public MouseButtons Buttons { get; }

Property Value

MouseButtons

ClientX

Gets the client X coordinates.

[DomName("clientX")]
public int ClientX { get; }

Property Value

int

ClientY

Gets the client Y coordinates.

[DomName("clientY")]
public int ClientY { get; }

Property Value

int

IsAltPressed

Gets if the alt key is pressed.

[DomName("altKey")]
public bool IsAltPressed { get; }

Property Value

bool

IsCtrlPressed

Gets if the control key is pressed.

[DomName("ctrlKey")]
public bool IsCtrlPressed { get; }

Property Value

bool

IsMetaPressed

Gets if the meta key is pressed.

[DomName("metaKey")]
public bool IsMetaPressed { get; }

Property Value

bool

IsShiftPressed

Gets if the shift key is pressed.

[DomName("shiftKey")]
public bool IsShiftPressed { get; }

Property Value

bool

ScreenX

Gets the screen X coordinates.

[DomName("screenX")]
public int ScreenX { get; }

Property Value

int

ScreenY

Gets the screen Y coordinates.

[DomName("screenY")]
public int ScreenY { get; }

Property Value

int

Target

Gets the target of the mouse event.

[DomName("relatedTarget")]
public IEventTarget? Target { get; }

Property Value

IEventTarget

Methods

GetModifierState(string)

Returns the current state of the specified modifier key.

[DomName("getModifierState")]
public bool GetModifierState(string key)

Parameters

key string

The modifier key to lookup.

Returns

bool

True if the key is currently pressed, otherwise false.

Init(string, bool, bool, IWindow?, int, int, int, int, int, bool, bool, bool, bool, MouseButton, IEventTarget?)

Initializes the mouse event.

[DomName("initMouseEvent")]
public void Init(string type, bool bubbles, bool cancelable, IWindow? view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, MouseButton button, IEventTarget? target)

Parameters

type string

The type of event.

bubbles bool

Determines if the event bubbles.

cancelable bool

Determines if the event is cancelable.

view IWindow

Sets the associated view for the UI event.

detail int

Sets the detail id for the UIevent.

screenX int

Sets the screen X coordinate.

screenY int

Sets the screen Y coordinate.

clientX int

Sets the client X coordinate.

clientY int

Sets the client Y coordinate.

ctrlKey bool

Sets if the control key was pressed.

altKey bool

Sets if the alt key was pressed.

shiftKey bool

Sets if the shift key was pressed.

metaKey bool

Sets if the meta key was pressed.

button MouseButton

Sets which button has been pressed.

target IEventTarget

The target of the mouse event.