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.DesktopBounds

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

[Visual Basic]
Public Property DesktopBounds As Rectangle
[C#]
public Rectangle DesktopBounds {get; set;}
[C++]
public: __property Rectangle get_DesktopBounds();
public: __property void set_DesktopBounds(Rectangle);
[JScript]
public function get DesktopBounds() : Rectangle;
public function set DesktopBounds(Rectangle);

Property Value

A Rectangle that represents the bounds of the form on the Windows desktop using desktop coordinates.

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 size and position a form relative to other forms or applications on the Windows desktop.

Example [C#]

The following example sets the size and 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 Rectangle object that will be used as the bound of the form.
   Rectangle tempRect = new Rectangle(50,50,100,100);
   ' Set the bounds of the form using the Rectangle object.
   Form1.DesktopBounds = tempRect;
}

See Also

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