Expand Minimize

Form.SetDesktopLocation Method

Sets the location of the form in desktop coordinates.

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

member SetDesktopLocation : 
        x:int * 
        y:int -> unit

Parameters

x
Type: System.Int32

The x-coordinate of the form's location.

y
Type: System.Int32

The y-coordinate of the form's location.

Desktop coordinates are based on the working area of the screen, which excludes the taskbar. You can use this method to position your form on the desktop. Since desktop coordinates are based on the working area of the form, you can use this method to ensure that your form is completely visible on the desktop. This method is intended to be used primarily for top-level forms; use the LayoutMdi method to position multiple-document interface (MDI) child forms.

The following code example demonstrates how to use the SetDesktopLocation, Load and Activate members. To run the example, paste the following code in a form called Form1 containing a button called Button1 and two Label controls called Label1 and Label2.

No code example is currently available or this language may not be supported.

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft