共用方式為


HtmlDocument.Click 事件

定義

發生於使用者按一下文件上的任何地方時。

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 

事件類型

HtmlElementEventHandler

範例

下列程式碼範例會偵測按一下檔、尋找 元素,並使用 ScrollIntoView 來對齊網頁頂端的專案。

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

備註

如需處理事件的詳細資訊,請參閱 處理和引發事件

適用於

另請參閱