HtmlElementEventArgs Class


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Provides data for the events defined on HtmlDocument and HtmlElement.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)


type HtmlElementEventArgs = 
        inherit EventArgs


Indicates whether the ALT key was pressed when this event occurred.


Gets or sets a value indicating whether the current event bubbles up through the element hierarchy of the HTML Document Object Model.


Gets or sets the position of the mouse cursor in the document's client area.


Indicates whether the CTRL key was pressed when this event occurred.


Gets the name of the event that was raised.


Gets the HtmlElement the mouse pointer is moving away from.


Gets the ASCII value of the keyboard character typed in a KeyPress, KeyDown, or KeyUp event.


Gets the mouse button that was clicked during a MouseDown or MouseUp event.


Gets or sets the position of the mouse cursor relative to a relatively positioned parent element.


Gets or sets the position of the mouse cursor relative to the element that raises the event.


Gets or sets the return value of the handled event.


Indicates whether the SHIFT key was pressed when this event occurred.


Gets the HtmlElement toward which the user is moving the mouse pointer.


Determines whether the specified object is equal to the current object.(Inherited from Object.)


Serves as the default hash function. (Inherited from Object.)


Gets the Type of the current instance.(Inherited from Object.)


Returns a string that represents the current object.(Inherited from Object.)

HtmlElementEventArgs encapsulates the same information found on the window.event object when programming against the unmanaged HTML DOM or when writing Active Script for HTML pages.

In most cases, you can use ToElement to find the HTML element that is receiving the event action, and FromElement to find the HTML element that the current event is causing us to leave. However, not every event supplies a value for these properties; see the managed documentation for an event, or the corresponding documentation in the Internet Explorer SDK documentation, to discover if the event supplies it.

Many events in the HTML DOM are sent to their parent elements unless they are cancelled. This is known as event bubbling. If a SPAN inside of a DIV receives a click, then a click event is raised for the SPAN first, then for the DIV, and finally for the HTML page's BODY element. BubbleEvent controls whether an event will behave in this manner or not.

The following code example demonstrates the use of this type. In the example, an event handler reports on the occurrence of the Click event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing Show with Console.WriteLine or appending the message to a multiline TextBox.

To run the example code, paste it into a project that contains an instance of type HtmlDocument named HtmlDocument1. Then ensure that the event handler is associated with the Click event.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top