Freigeben über


Form.DesktopBounds-Eigenschaft

Ruft Größe und Position des Formulars auf dem Windows-Desktop ab oder legt diese fest.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Public Property DesktopBounds As Rectangle
'Usage
Dim instance As Form
Dim value As Rectangle

value = instance.DesktopBounds

instance.DesktopBounds = value
public Rectangle DesktopBounds { get; set; }
public:
property Rectangle DesktopBounds {
    Rectangle get ();
    void set (Rectangle value);
}
/** @property */
public Rectangle get_DesktopBounds ()

/** @property */
public void set_DesktopBounds (Rectangle value)
public function get DesktopBounds () : Rectangle

public function set DesktopBounds (value : Rectangle)

Eigenschaftenwert

Ein Rectangle, das die Begrenzungen des Formulars auf dem Windows-Desktop in Desktopkoordinaten darstellt.

Hinweise

Desktopkoordinaten beruhen auf dem Arbeitsbereich des Bildschirms, wobei die Taskleiste nicht mitgerechnet wird. Die Koordinaten des Desktops werden in Pixel angegeben. Wenn die Anwendung auf einem System mit mehreren Bildschirmen ausgeführt wird, beziehen sich die Koordinaten des Formulars auf den kombinierten Desktop.

Mit dieser Eigenschaft können Sie Größe und Position eines Formulars relativ zu anderen Formularen oder Anwendungen auf dem Windows-Desktop bestimmen.

Beispiel

Im folgenden Codebeispiel werden Größe und Position eines Formulars so festgelegt, dass sich das Formular 50 Pixel rechts neben dem linken und 50 Pixel unter dem oberen Rand des Desktops befindet. Für dieses Beispiel ist es erforderlich, dass die Methode in einer Formularklasse definiert ist.

Public Sub MoveMyForm()
    ' Create a Rectangle object that will be used as the bound of the form.
    Dim tempRect As New Rectangle(50, 50, 100, 100)
    '  Set the bounds of the form using the Rectangle object.
    DesktopBounds = tempRect
End Sub 'MoveMyForm
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.
    this.DesktopBounds = tempRect;
 }
   
public:
   void MoveMyForm()
   {
      // Create a Rectangle object that will be used as the bound of the form.
      Rectangle tempRect = Rectangle( 50, 50, 100, 100 );
      // Set the bounds of the form using the Rectangle object.
      this->DesktopBounds = tempRect;
   }
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.
    this.set_DesktopBounds(tempRect);
} //MoveMyForm

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

Form-Klasse
Form-Member
System.Windows.Forms-Namespace
DesktopLocation