Form.DesktopBounds Właściwość

Definicja

Pobiera lub ustawia rozmiar i lokalizację formularza na pulpicie systemu 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

Wartość właściwości

Obiekt Rectangle reprezentujący granice formularza na pulpicie systemu Windows przy użyciu współrzędnych pulpitu.

Atrybuty

Przykłady

Poniższy przykład ustawia rozmiar i położenie formularza tak, aby formularz był umieszczony 50 pikseli od lewej krawędzi pulpitu i 50 pikseli od góry pulpitu. Ten przykład wymaga, aby metoda została zdefiniowana w klasie formularza.

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

Uwagi

Współrzędne pulpitu są oparte na obszarze roboczym ekranu, który wyklucza pasek zadań. Układ współrzędnych pulpitu jest oparty na pikselach. Jeśli aplikacja jest uruchomiona w systemie wielu monitorów, współrzędne formularza są współrzędnymi dla połączonego pulpitu.

Za pomocą tej właściwości można ustawiać rozmiar i pozycjonować formularz względem innych formularzy lub aplikacji na pulpicie systemu Windows.

Dotyczy

Zobacz też