HtmlDocument.Click HtmlDocument.Click HtmlDocument.Click HtmlDocument.Click Event

定義

ユーザーがドキュメント内の任意の場所をクリックしたときに発生します。Occurs when the user clicks anywhere on the document.

public:
 event System::Windows::Forms::HtmlElementEventHandler ^ Click;
public event System.Windows.Forms.HtmlElementEventHandler Click;
member this.Click : System.Windows.Forms.HtmlElementEventHandler 
Public Custom Event Click As HtmlElementEventHandler 

次のコード例が、文書のクリックを検出し、要素を検索して使用ScrollIntoViewWeb ページの上部を持つ要素を配置します。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.

private void Document_Click(Object sender, HtmlElementEventArgs e)
{
    if (webBrowser1.Document != null)
    {
        HtmlElement elem = webBrowser1.Document.GetElementFromPoint(e.ClientMousePosition);
        elem.ScrollIntoView(true);
    }
}
Private Sub Document_Click(ByVal sender As Object, ByVal e As HtmlElementEventArgs)
    If (WebBrowser1.Document IsNot Nothing) Then
        Dim Elem As HtmlElement = WebBrowser1.Document.GetElementFromPoint(e.ClientMousePosition)
        Elem.ScrollIntoView(True)
    End If
End Sub

注釈

イベントの処理の詳細については、「処理とイベントの発生」を参照してください。For more information about handling events, see Handling and Raising Events.

適用対象

こちらもご覧ください