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);
A Point that represents the location of the form on the desktop.
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.
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; }
Form Class | Form Members | System.WinForms Namespace | DesktopBounds