Form.DesktopBounds Vlastnost

Definice

Získá nebo nastaví velikost a umístění formuláře na ploše Windows.

public:
 property System::Drawing::Rectangle DesktopBounds { System::Drawing::Rectangle get(); void set(System::Drawing::Rectangle value); };
[System.ComponentModel.Browsable(false)]
public System.Drawing.Rectangle DesktopBounds { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.DesktopBounds : System.Drawing.Rectangle with get, set
Public Property DesktopBounds As Rectangle

Hodnota vlastnosti

Rectangle

A Rectangle , který představuje hranice formuláře na ploše Windows pomocí souřadnic plochy.

Atributy

Příklady

Následující příklad nastaví velikost a pozici formuláře tak, aby byl formulář umístěn 50 pixelů od levého okraje plochy a 50 pixelů od horní části plochy. Tento příklad vyžaduje, aby metoda byla definována v rámci třídy formuláře.

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.DesktopBounds = tempRect;
 }
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

Poznámky

Souřadnice plochy jsou založeny na pracovní oblasti obrazovky, která vylučuje hlavní panel. Souřadnicový systém plochy je založený na pixelech. Pokud je vaše aplikace spuštěná v systému s více monitory, souřadnice formuláře jsou souřadnice kombinované plochy.

Tuto vlastnost můžete použít k velikosti a umístění formuláře vzhledem k jiným formulářům nebo aplikacím na ploše Windows.

Platí pro

Viz také