HtmlWindow.Position Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the position of the window's client area on the screen.
public:
property System::Drawing::Point Position { System::Drawing::Point get(); };
public System.Drawing.Point Position { get; }
member this.Position : System.Drawing.Point
Public ReadOnly Property Position As Point
Property Value
A Point describing the x -and y-coordinates of the top-left corner of the screen, in pixels.
Examples
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("http://www.adatum.com/popup.htm"), "left=" + docWindow.Position.X + ",top=" + docWindow.Position.Y + ",width=" + webBrowser1.Width + ",height=" + webBrowser1.Height);
}
}
Private Sub OpenNewWindowOverBrowser()
If (WebBrowser1.Document IsNot Nothing) Then
Dim DocWindow As HtmlWindow = WebBrowser1.Document.Window
Dim NewWindow As HtmlWindow = DocWindow.OpenNew(New Uri("http://www.adatum.com/popup.htm"), "left=" & DocWindow.Position.X & ",top=" & DocWindow.Position.Y & ",width=" & WebBrowser1.Width & ",height=" & WebBrowser1.Height)
End If
End Sub
Remarks
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.
Applies to
See also
.NET