NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Form.DesktopLocation

Gets or sets the location of the form on the Windows desktop.

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

Property Value

A Point that represents the location of the form on the desktop.

Remarks

Desktop coordinates are based on the working area of the screen, which excludes the taskbar. The coordinate system of the desktop is pixel based. If your application is running on a multi-monitor system, the coodinates of the form are the coordinates for the combined desktop.

You can use this property to position your form relative to other forms and applications on the Windows desktop.

Example [C#]

The following example sets the position of a form so that the form is positioned 100 pixels from the left border of the desktop and 100 pixels from the top of the top of the desktop. This example assumes that a form named Form1 has already been created.

[C#]

public void MoveMyForm()
{
   ' Create a Point object that will be used as the location of the form.
   Point tempPoint = new Point(100,100);
   ' Set the location of the form using the Point object.
   Form1.DesktopBounds = tempPoint;
}

See Also

Form Class | Form Members | System.WinForms Namespace | DesktopBounds