Screen.GetWorkingArea Méthode

Définition

Récupère l'espace de travail d'un affichage.

Surcharges

GetWorkingArea(Point)

Récupère l'espace de travail le plus proche du point spécifié. L'espace de travail est la zone d'affichage du bureau, à l'exception des barres des tâches, des fenêtres ancrées et des barres d'outils ancrées.

GetWorkingArea(Rectangle)

Récupère l'espace de travail de l'affichage qui contient la plus grande partie du rectangle spécifié. L'espace de travail est la zone d'affichage du bureau, à l'exception des barres des tâches, des fenêtres ancrées et des barres d'outils ancrées.

GetWorkingArea(Control)

Récupère l'espace de travail de l'affichage qui contient la plus grande zone du contrôle spécifié. L'espace de travail est la zone d'affichage du bureau, à l'exception des barres des tâches, des fenêtres ancrées et des barres d'outils ancrées.

GetWorkingArea(Point)

Récupère l'espace de travail le plus proche du point spécifié. L'espace de travail est la zone d'affichage du bureau, à l'exception des barres des tâches, des fenêtres ancrées et des barres d'outils ancrées.

public:
 static System::Drawing::Rectangle GetWorkingArea(System::Drawing::Point pt);
public static System.Drawing.Rectangle GetWorkingArea (System.Drawing.Point pt);
static member GetWorkingArea : System.Drawing.Point -> System.Drawing.Rectangle
Public Shared Function GetWorkingArea (pt As Point) As Rectangle

Paramètres

pt
Point

Point qui spécifie les coordonnées pour lesquelles l'espace de travail doit être récupéré.

Retours

Rectangle

Rectangle qui spécifie l'espace de travail. Dans plusieurs environnements d'affichage où aucun affichage ne contient le point spécifié, l'affichage le plus proche du point est retourné.

Exemples

L’exemple de code suivant illustre l’utilisation de PrimaryScreen la propriété et de la GetWorkingArea méthode. Cette méthode nécessite un formulaire contenant un bouton nommé Button1

   // This method will adjust the size of the form to utilize 
   // the working area of the screen.
private:
   void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      // Retrieve the working rectangle from the Screen class
      // using the PrimaryScreen and the WorkingArea properties.
      System::Drawing::Rectangle workingRectangle = Screen::PrimaryScreen->WorkingArea;
      
      // Set the size of the form slightly less than size of 
      // working rectangle.
      this->Size = System::Drawing::Size( workingRectangle.Width - 10, workingRectangle.Height - 10 );
      
      // Set the location so the entire form is visible.
      this->Location = System::Drawing::Point( 5, 5 );
   }
// This method will adjust the size of the form to utilize 
// the working area of the screen.
private void Button1_Click(System.Object sender, System.EventArgs e)
{
    // Retrieve the working rectangle from the Screen class
    // using the PrimaryScreen and the WorkingArea properties.
    System.Drawing.Rectangle workingRectangle = 
        Screen.PrimaryScreen.WorkingArea;
    
    // Set the size of the form slightly less than size of 
    // working rectangle.
    this.Size = new System.Drawing.Size(
        workingRectangle.Width-10, workingRectangle.Height-10);

    // Set the location so the entire form is visible.
    this.Location = new System.Drawing.Point(5, 5);
}
' This method will adjust the size of the form to utilize 
' the working area of the screen.

Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click

    ' Retrieve the working rectangle from the Screen class
    ' using the PrimaryScreen and the WorkingArea properties. 
    Dim workingRectangle As System.Drawing.Rectangle = _
        Screen.PrimaryScreen.WorkingArea

    ' Set the size of the form slightly less than size of 
    ' working rectangle.
    Me.Size = New System.Drawing.Size(workingRectangle.Width - 10, _
        workingRectangle.Height - 10)

    ' Set the location so the entire form is visible.
    Me.Location = New System.Drawing.Point(5, 5)

End Sub

S’applique à

GetWorkingArea(Rectangle)

Récupère l'espace de travail de l'affichage qui contient la plus grande partie du rectangle spécifié. L'espace de travail est la zone d'affichage du bureau, à l'exception des barres des tâches, des fenêtres ancrées et des barres d'outils ancrées.

public:
 static System::Drawing::Rectangle GetWorkingArea(System::Drawing::Rectangle rect);
public static System.Drawing.Rectangle GetWorkingArea (System.Drawing.Rectangle rect);
static member GetWorkingArea : System.Drawing.Rectangle -> System.Drawing.Rectangle
Public Shared Function GetWorkingArea (rect As Rectangle) As Rectangle

Paramètres

rect
Rectangle

Rectangle qui spécifie la zone pour laquelle l'espace de travail doit être récupéré.

Retours

Rectangle

Rectangle qui spécifie l'espace de travail. Dans plusieurs environnements d'affichage où aucun affichage ne contient le rectangle spécifié, l'affichage le plus proche du rectangle est retourné.

S’applique à

GetWorkingArea(Control)

Récupère l'espace de travail de l'affichage qui contient la plus grande zone du contrôle spécifié. L'espace de travail est la zone d'affichage du bureau, à l'exception des barres des tâches, des fenêtres ancrées et des barres d'outils ancrées.

public:
 static System::Drawing::Rectangle GetWorkingArea(System::Windows::Forms::Control ^ ctl);
public static System.Drawing.Rectangle GetWorkingArea (System.Windows.Forms.Control ctl);
static member GetWorkingArea : System.Windows.Forms.Control -> System.Drawing.Rectangle
Public Shared Function GetWorkingArea (ctl As Control) As Rectangle

Paramètres

ctl
Control

Control pour lequel l'espace de travail doit être récupéré.

Retours

Rectangle

Rectangle qui spécifie l'espace de travail. Dans plusieurs environnements d'affichage où aucun affichage ne contient le contrôle spécifié, l'affichage le plus proche du contrôle est retourné.

S’applique à