Control.SetBounds Yöntem

Tanım

Denetimin sınırlarını ayarlar.

Aşırı Yüklemeler

SetBounds(Int32, Int32, Int32, Int32)

Denetimin sınırlarını belirtilen konuma ve boyuta ayarlar.

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

Denetimin belirtilen sınırlarını belirtilen konum ve boyuta ayarlar.

SetBounds(Int32, Int32, Int32, Int32)

Denetimin sınırlarını belirtilen konuma ve boyuta ayarlar.

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)

Parametreler

x
Int32

Denetimin yeni Left özellik değeri.

y
Int32

Denetimin yeni Top özellik değeri.

width
Int32

Denetimin yeni Width özellik değeri.

height
Int32

Denetimin yeni Height özellik değeri.

Ayrıca bkz.

Şunlara uygulanır

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

Denetimin belirtilen sınırlarını belirtilen konum ve boyuta ayarlar.

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)

Parametreler

x
Int32

Denetimin yeni Left özellik değeri.

y
Int32

Denetimin yeni Top özellik değeri.

width
Int32

Denetimin yeni Width özellik değeri.

height
Int32

Denetimin yeni Height özellik değeri.

specified
BoundsSpecified

Değerlerin bit düzeyinde birleşimi BoundsSpecified . Belirtilmeyen herhangi bir parametre için geçerli değer kullanılır.

Örnekler

Aşağıdaki kod örneği, olaydaki ekranda bir Form ortalar Layout . Bu, kullanıcı yeniden boyutlandırdıkça formu ortalar. Bu örnekte bir Form denetim oluşturmuş olmanız gerekir.

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

Ayrıca bkz.

Şunlara uygulanır