Screen.GetWorkingArea Método

Definição

Recupera a área de trabalho de um ecrã.

Sobrecargas

Name Description
GetWorkingArea(Point)

Recupera a área de trabalho mais próxima do ponto especificado. A área de trabalho é a área de trabalho do ecrã, excluindo barras de tarefas, janelas acopladas e barras de ferramentas acopladas.

GetWorkingArea(Rectangle)

Recupera a área de trabalho do ecrã que contém a maior parte do retângulo especificado. A área de trabalho é a área de trabalho do ecrã, excluindo barras de tarefas, janelas acopladas e barras de ferramentas acopladas.

GetWorkingArea(Control)

Recupera a área de trabalho do ecrã que contém a maior região do controlo especificado. A área de trabalho é a área de trabalho do ecrã, excluindo barras de tarefas, janelas acopladas e barras de ferramentas acopladas.

GetWorkingArea(Point)

Recupera a área de trabalho mais próxima do ponto especificado. A área de trabalho é a área de trabalho do ecrã, excluindo barras de tarefas, janelas acopladas e barras de ferramentas acopladas.

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

Parâmetros

pt
Point

A Point que especifica as coordenadas para as quais recuperar a área de trabalho.

Devoluções

A Rectangle que especifica a área de trabalho. Em múltiplos ambientes de ecrã onde nenhum ecrã contém o ponto especificado, o ecrã mais próximo desse ponto é devolvido.

Exemplos

O seguinte exemplo de código demonstra o uso da PrimaryScreen propriedade e o GetWorkingArea método. Este método requer um formulário contendo um botão nomeado 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

Aplica-se a

GetWorkingArea(Rectangle)

Recupera a área de trabalho do ecrã que contém a maior parte do retângulo especificado. A área de trabalho é a área de trabalho do ecrã, excluindo barras de tarefas, janelas acopladas e barras de ferramentas acopladas.

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

Parâmetros

rect
Rectangle

Essa Rectangle especifica a área para a qual deve ser recuperada a área de trabalho.

Devoluções

A Rectangle que especifica a área de trabalho. Em múltiplos ambientes de ecrã onde nenhum contém o retângulo especificado, o ecrã mais próximo do retângulo é devolvido.

Aplica-se a

GetWorkingArea(Control)

Recupera a área de trabalho do ecrã que contém a maior região do controlo especificado. A área de trabalho é a área de trabalho do ecrã, excluindo barras de tarefas, janelas acopladas e barras de ferramentas acopladas.

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

Parâmetros

ctl
Control

Para Control recuperar a área de trabalho.

Devoluções

A Rectangle que especifica a área de trabalho. Em múltiplos ambientes de ecrã onde nenhum contém o controlo especificado, o ecrã mais próximo do controlo é devolvido.

Aplica-se a