Control.SuspendLayout Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Denetim için düzen mantığını geçici olarak askıya alır.
public:
void SuspendLayout();
public void SuspendLayout();
member this.SuspendLayout : unit -> unit
Public Sub SuspendLayout ()
Örnekler
Aşağıdaki kod örneği forma iki düğme ekler. Örnek, ve SuspendLayout yöntemlerini kullanarak düğmelerin eklenmesini ResumeLayout işleme alır.
private:
void AddButtons()
{
// Suspend the form layout and add two buttons.
this->SuspendLayout();
Button^ buttonOK = gcnew Button;
buttonOK->Location = Point(10,10);
buttonOK->Size = System::Drawing::Size( 75, 25 );
buttonOK->Text = "OK";
Button^ buttonCancel = gcnew Button;
buttonCancel->Location = Point(90,10);
buttonCancel->Size = System::Drawing::Size( 75, 25 );
buttonCancel->Text = "Cancel";
array<Control^>^temp5 = {buttonOK,buttonCancel};
this->Controls->AddRange( temp5 );
this->ResumeLayout();
}
private void AddButtons()
{
// Suspend the form layout and add two buttons.
this.SuspendLayout();
Button buttonOK = new Button();
buttonOK.Location = new Point(10, 10);
buttonOK.Size = new Size(75, 25);
buttonOK.Text = "OK";
Button buttonCancel = new Button();
buttonCancel.Location = new Point(90, 10);
buttonCancel.Size = new Size(75, 25);
buttonCancel.Text = "Cancel";
this.Controls.AddRange(new Control[]{buttonOK, buttonCancel});
this.ResumeLayout();
}
Private Sub AddButtons()
' Suspend the form layout and add two buttons.
Me.SuspendLayout()
Dim buttonOK As New Button()
buttonOK.Location = New Point(10, 10)
buttonOK.Size = New Size(75, 25)
buttonOK.Text = "OK"
Dim buttonCancel As New Button()
buttonCancel.Location = New Point(90, 10)
buttonCancel.Size = New Size(75, 25)
buttonCancel.Text = "Cancel"
Me.Controls.AddRange(New Control() {buttonOK, buttonCancel})
Me.ResumeLayout()
End Sub
Açıklamalar
Yöntemi çağrılana kadar denetimin ResumeLayout düzen mantığı askıya alınır.
ve SuspendLayout yöntemleri, denetimin ResumeLayout birden çok özniteliğini ayarlarken birden çok Layout olayı engellemek için birlikte kullanılır. Örneğin, genellikle yöntemini çağırır SuspendLayout , ardından denetimin Size, Location, Anchorveya Dock özelliklerini ayarlar ve sonra değişikliklerin etkili olmasını sağlamak için yöntemini çağırırsınız ResumeLayout .
Başarıyla çağrılabilmesi için SuspendLayout bekleyen çağrı ResumeLayout olmaması gerekir.
Note
Üst denetime birkaç denetim eklerken, eklenecek denetimleri başlatmadan önce yöntemini çağırmanız SuspendLayout önerilir. Denetimleri üst denetime ekledikten sonra yöntemini çağırın ResumeLayout . Bu, birçok denetime sahip uygulamaların performansını artırır.