Edit

Share via


HtmlWindow.MoveTo Method

Definition

Moves the window to the specified coordinates on the screen.

Overloads

MoveTo(Point)

Moves the window to the specified coordinates on the screen.

MoveTo(Int32, Int32)

Moves the window to the specified coordinates on the screen.

MoveTo(Point)

Moves the window to the specified coordinates on the screen.

public:
 void MoveTo(System::Drawing::Point point);
public void MoveTo (System.Drawing.Point point);
member this.MoveTo : System.Drawing.Point -> unit
Public Sub MoveTo (point As Point)

Parameters

point
Point

The x- and y-coordinates of the window's upper-left corner.

Exceptions

The code trying to execute this operation does not have permission to manipulate this window.

Remarks

You cannot use MoveTo to move a window off of the visible edge of the screen; this method is also available through script on a Web page, and allowing untrusted script to render windows invisible is not considered secure.

MoveTo will raise an UnauthorizedAccessException if the window you are trying to move and its parent window have different top-level domains. For example, if you are hosting the WebBrowser control pointing to a.adatum.com, create a new window using OpenNew to display b.adatum.com. In this case, both windows are considered to be part of the same top-level domain, and the exception is not thrown. However, if you call OpenNew to display www,microsoft.com, the two windows now have different top-level domains, and the MoveTo operation will cause the exception to throw.

See also

Applies to

MoveTo(Int32, Int32)

Moves the window to the specified coordinates on the screen.

public:
 void MoveTo(int x, int y);
public void MoveTo (int x, int y);
member this.MoveTo : int * int -> unit
Public Sub MoveTo (x As Integer, y As Integer)

Parameters

x
Int32

The x-coordinate of the window's upper-left corner.

y
Int32

The y-coordinate of the window's upper-left corner.

Exceptions

The code trying to execute this operation does not have permission to manipulate this window.

Remarks

You cannot use MoveTo to move a window off of the visible edge of the screen; this method is also available through script on a Web page, and allowing untrusted script to render windows invisible is not considered secure.

MoveTo will raise an UnauthorizedAccessException if the window you are trying to move and its parent window have different top-level domains. For example, if you are hosting the WebBrowser control and it is pointing to a.adatum.com, you create a new window using OpenNew to display b.adatum.com. In this case, both windows are considered to be part of the same top-level domain, and the exception is not thrown. However, if you call OpenNew to display www,microsoft.com, the two windows now have different top-level domains, and the MoveTo operation will cause the exception to throw.

Applies to