語言

Control.ResumeLayout 方法

定義

恢復了平常的版面邏輯。

多載

名稱 Description
ResumeLayout()

恢復慣用的版面邏輯。

ResumeLayout(Boolean)

恢復一般版面邏輯,並可選擇性地立即強制放置待處理版面請求。

ResumeLayout()

來源:
Control.cs
來源:
Control.cs
來源:
Control.cs
來源:
Control.cs
來源:
Control.cs

恢復慣用的版面邏輯。

public:
 void ResumeLayout();
public void ResumeLayout();
member this.ResumeLayout : unit -> unit
Public Sub ResumeLayout ()

範例

以下範例在表單中新增兩個按鈕。 範例中透過 and SuspendLayout 方法來新增按鈕ResumeLayout。

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

備註

呼叫該 ResumeLayout 方法會強制立即執行任何待處理的佈局請求。

SuspendLayout ResumeLayout和 方法會同時使用,以抑制多個Layout事件,同時調整控制的多項屬性。 例如,你通常會呼叫方法 SuspendLayout ,然後設定 Size控制項的 、 Location、 Anchor或 Dock 屬性,接著呼叫該 ResumeLayout 方法來啟用變更的生效。

必須沒有待處理的呼叫,SuspendLayoutResumeLayout才能成功呼叫。

另請參閱

適用於

ResumeLayout(Boolean)

來源:
Control.cs
來源:
Control.cs
來源:
Control.cs
來源:
Control.cs
來源:
Control.cs

恢復一般版面邏輯,並可選擇性地立即強制放置待處理版面請求。

public:
 void ResumeLayout(bool performLayout);
public void ResumeLayout(bool performLayout);
member this.ResumeLayout : bool -> unit
Public Sub ResumeLayout (performLayout As Boolean)

參數

performLayout
Boolean

true執行待處理版面設計請求;否則,。 false

備註

呼叫該 ResumeLayout 方法會強制立即執行任何待處理的佈局請求。 當參數 performLayout 設為 true時,若有任何待處理的佈局請求,則立即進行佈局。

SuspendLayout ResumeLayout和 方法會同時使用,以抑制多個Layout事件,同時調整控制的多項屬性。 例如,你通常會呼叫方法 SuspendLayout ,然後設定 Size控制項的 、 Location、 Anchor或 Dock 屬性,接著呼叫該 ResumeLayout 方法來啟用變更的生效。

必須沒有待處理的呼叫,SuspendLayoutResumeLayout才能成功呼叫。

Note

在父控制項中加入多個控制項時,建議在初始化要加入的控制項前先呼叫該 SuspendLayout 方法。 將控制項加入父控制項後,呼叫該 ResumeLayout 方法。 這將提升擁有多種控制元件的應用程式效能。

另請參閱

適用於