HtmlWindow.Position Property


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

Gets the position of the window's client area on the screen.

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

public Point Position { get; }

Property Value

Type: System.Drawing.Point

A Point describing the x -and y-coordinates of the top-left corner of the screen, in pixels.

The Location property of the WebBrowser control will return the position of the control relative to the upper-left corner of the form. By contrast, Position will return the location of the document's display area relative to the top-left corner of the user's monitor.

The following code example opens a new window directly over the WebBrowser control on the form. The code example requires that your form contains an instance of the WebBrowser control named WebBrowser1.

private void OpenNewWindowOverBrowser()
	if (webBrowser1.Document != null)
		HtmlWindow docWindow = webBrowser1.Document.Window;
		HtmlWindow newWindow = docWindow.OpenNew(new Uri(""), "left=" + docWindow.Position.X + ",top=" + docWindow.Position.Y + ",width=" + webBrowser1.Width + ",height=" + webBrowser1.Height);

.NET Framework
Available since 2.0
Return to top