Questo articolo è stato tradotto automaticamente. Per visualizzare l'articolo in inglese, selezionare la casella di controllo Inglese. È possibile anche visualizzare il testo inglese in una finestra popup posizionando il puntatore del mouse sopra il testo.
Traduzione
Inglese

Proprietà Form.DesktopLocation

 

Data di pubblicazione: ottobre 2016

Ottiene o imposta la posizione del form sul desktop di Windows.

Spazio dei nomi:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

[BrowsableAttribute(false)]
public Point DesktopLocation { get; set; }

Valore proprietà

Type: System.Drawing.Point

Oggetto Point che rappresenta la posizione del form sul desktop di Windows.

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 multimonitor system, the coordinates 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.

If you call the M:System.Windows.Forms.Form.SetDesktopLocation(System.Int32,System.Int32) method before calling the M:System.Windows.Forms.Form.Show(System.Windows.Forms.IWin32Window) method, your form will be positioned at its default location, which is determined by the operating system. For more information about window positioning, see the "Window Size and Position" section of the "Window Features" document in the MSDN library at http://msdn.microsoft.com/library.

If you call M:System.Windows.Forms.Form.SetDesktopLocation(System.Int32,System.Int32) after calling M:System.Windows.Forms.Form.Show(System.Windows.Forms.IWin32Window), your form will be positioned at the location you specified.

The following code 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 desktop. This example requires that method has been defined within a form class.

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.
    this.DesktopLocation = tempPoint;
 }

.NET Framework
Disponibile da 1.1
Torna all'inizio
Mostra: