This documentation is archived and is not being maintained.

Control.Location Property

Gets or sets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container.

[Visual Basic]
Public Property Location As Point
[C#]
public Point Location {get; set;}
[C++]
public: __property Point get_Location();
public: __property void set_Location(Point);
[JScript]
public function get Location() : Point;
public function set Location(Point);

Property Value

The Point that represents the upper-left corner of the control relative to the upper-left corner of its container.

Remarks

Because the Point class is a value type (Structure in Visual Basic, struct in C#), it is returned by value, meaning accessing the property returns a copy of the upper-left point of the control. So, adjusting the X or Y properties of the Point object returned from this property will not affect the Left, Right, Top, or Bottom property values of the control. To adjust these properties set each property value individually, or set the Location property with a new Point object.

If the Control is a Form, the Location property value represents the upper-left corner of the Form in screen coordinates.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

Control Class | Control Members | System.Windows.Forms Namespace | Form | ContainerControl

Show: