Control.SetBounds Control.SetBounds Control.SetBounds Control.SetBounds Method

Definição

Define os limites dos controles.Sets the bounds of the control.

Sobrecargas

SetBounds(Int32, Int32, Int32, Int32) SetBounds(Int32, Int32, Int32, Int32) SetBounds(Int32, Int32, Int32, Int32) SetBounds(Int32, Int32, Int32, Int32)

Define os limites do controle para a localização e o tamanho especificados.Sets the bounds of the control to the specified location and size.

SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified) SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified) SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified) SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified)

Define os limites especificados do controle para a localização e tamanho especificados.Sets the specified bounds of the control to the specified location and size.

SetBounds(Int32, Int32, Int32, Int32) SetBounds(Int32, Int32, Int32, Int32) SetBounds(Int32, Int32, Int32, Int32) SetBounds(Int32, Int32, Int32, Int32)

Define os limites do controle para a localização e o tamanho especificados.Sets the bounds of the control to the specified location and size.

public:
 void SetBounds(int x, int y, int width, int height);
public void SetBounds (int x, int y, int width, int height);
member this.SetBounds : int * int * int * int -> unit
Public Sub SetBounds (x As Integer, y As Integer, width As Integer, height As Integer)

Parâmetros

x
Int32 Int32 Int32 Int32

O novo valor da propriedade Left do controle.The new Left property value of the control.

y
Int32 Int32 Int32 Int32

O novo valor da propriedade Top do controle.The new Top property value of the control.

width
Int32 Int32 Int32 Int32

O novo valor da propriedade Width do controle.The new Width property value of the control.

height
Int32 Int32 Int32 Int32

O novo valor da propriedade Height do controle.The new Height property value of the control.

Veja também

SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified) SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified) SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified) SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified)

Define os limites especificados do controle para a localização e tamanho especificados.Sets the specified bounds of the control to the specified location and size.

public:
 void SetBounds(int x, int y, int width, int height, System::Windows::Forms::BoundsSpecified specified);
public void SetBounds (int x, int y, int width, int height, System.Windows.Forms.BoundsSpecified specified);
member this.SetBounds : int * int * int * int * System.Windows.Forms.BoundsSpecified -> unit
Public Sub SetBounds (x As Integer, y As Integer, width As Integer, height As Integer, specified As BoundsSpecified)

Parâmetros

x
Int32 Int32 Int32 Int32

O novo valor da propriedade Left do controle.The new Left property value of the control.

y
Int32 Int32 Int32 Int32

O novo valor da propriedade Top do controle.The new Top property value of the control.

width
Int32 Int32 Int32 Int32

O novo valor da propriedade Width do controle.The new Width property value of the control.

height
Int32 Int32 Int32 Int32

O novo valor da propriedade Height do controle.The new Height property value of the control.

specified
BoundsSpecified BoundsSpecified BoundsSpecified BoundsSpecified

Uma combinação bit a bit dos valores BoundsSpecified.A bitwise combination of the BoundsSpecified values. Para qualquer parâmetro não especificado, o valor atual será usado.For any parameter not specified, the current value will be used.

Exemplos

O exemplo de código a seguir Form centraliza um na tela Layout no evento.The following code example centers a Form on the screen in the Layout event. Isso manterá o formulário centralizado conforme o usuário o redimensiona.This will keep the form centered as the user resizes it. Este exemplo requer que você tenha criado um Form controle.This example requires that you have created a Form control.

private:
   void MyForm_Layout( Object^ /*sender*/, System::Windows::Forms::LayoutEventArgs^ /*e*/ )
   {
      // Center the Form on the user's screen everytime it requires a Layout.
      this->SetBounds( (Screen::GetBounds( this ).Width / 2) - (this->Width / 2), (Screen::GetBounds( this ).Height / 2) - (this->Height / 2), this->Width, this->Height, BoundsSpecified::Location );
   }
private void MyForm_Layout(object sender, System.Windows.Forms.LayoutEventArgs e)
{
   // Center the Form on the user's screen everytime it requires a Layout.
   this.SetBounds((Screen.GetBounds(this).Width/2) - (this.Width/2),
       (Screen.GetBounds(this).Height/2) - (this.Height/2),
 this.Width, this.Height, BoundsSpecified.Location);	
}

Private Sub MyForm_Layout(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.LayoutEventArgs) Handles MyBase.Layout

    ' Center the Form on the user's screen everytime it requires a Layout.
    Me.SetBounds((System.Windows.Forms.Screen.GetBounds(Me).Width / 2) - (Me.Width / 2), _
        (System.Windows.Forms.Screen.GetBounds(Me).Height / 2) - (Me.Height / 2), _
        Me.Width, Me.Height, System.Windows.Forms.BoundsSpecified.Location)
End Sub
Veja também

Aplica-se a