728x90
Retrieves the HTML element located at the specified client coordinates.
public:
System::Windows::Forms::HtmlElement ^ GetElementFromPoint(System::Drawing::Point point);
C#
public System.Windows.Forms.HtmlElement GetElementFromPoint (System.Drawing.Point point);
member this.GetElementFromPoint : System.Drawing.Point -> System.Windows.Forms.HtmlElement
Public Function GetElementFromPoint (point As Point) As HtmlElement
Parameters
- point
- Point
The x,y position of the element on the screen, relative to the top-left corner of the document.
Returns
The HtmlElement at the specified screen location in the document.
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);
}
}
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
Remarks
GetElementFromPoint uses client coordinates, in which the upper-left corner of the document is assigned the value (0,0). Client coordinates for the current position of the cursor can be obtained using the Position property.
Applies to
.NET
5.0 Preview 7
.NET Core
3.1 3.0
.NET Framework
4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6 4.5.2 4.5.1 4.5 4.0 3.5 3.0 2.0
728x90
'자료' 카테고리의 다른 글
[ C#,VB.NET ]Mutex를 이용한 프로세스 통제 (중복 실행 방지) (0) | 2020.08.09 |
---|---|
C# Selenium Webdriver alert창 Enter하기 (0) | 2020.08.09 |
[C#,VB.net]자기자신 파일삭제(selfKill) (0) | 2020.08.08 |
[VB.NET/C#]GetClientRect, GetWindowRect (0) | 2020.08.08 |
Everything (윈도우용 빠른 파일 검색 프로그램) (0) | 2020.08.08 |