Export (0) Print
Expand All

HtmlWindow.MoveTo Method (Int32, Int32)

Moves the window to the specified coordinates on the screen.

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

public void MoveTo(
	int x,
	int y


Type: System.Int32

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

Type: System.Int32

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


The code trying to execute this operation does not have permission to manipulate this window. See the Remarks section for details.

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.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft