HtmlDocument.Click Event

Definition

Occurs when the user clicks anywhere on the document.

C#
public event System.Windows.Forms.HtmlElementEventHandler Click;
C#
public event System.Windows.Forms.HtmlElementEventHandler? Click;

Event Type

Examples

The following code example detects a click on the document, finds the element, and uses ScrollIntoView to align the element with the top of the Web page.

C#
private void Document_Click(Object sender, HtmlElementEventArgs e)
{
    if (webBrowser1.Document != null)
    {
        HtmlElement elem = webBrowser1.Document.GetElementFromPoint(e.ClientMousePosition);
        elem.ScrollIntoView(true);
    }
}

Remarks

For more information about handling events, see Handling and Raising Events.

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also