Control.ResumeLayout 方法

定義

繼續平常的配置邏輯。Resumes the usual layout logic.

多載

ResumeLayout()

繼續平常的配置邏輯。Resumes usual layout logic.

ResumeLayout(Boolean)

繼續平常的配置邏輯,選擇性地強制暫止配置要求的立即配置。Resumes usual layout logic, optionally forcing an immediate layout of pending layout requests.

ResumeLayout()

繼續平常的配置邏輯。Resumes usual layout logic.

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

範例

下列程式碼範例會將兩個按鈕加入至表單。The following code example adds two buttons to a form. 此範例使用 SuspendLayoutResumeLayout 方法來交易新增按鈕。The example transactions the addition of the buttons by using the SuspendLayout and ResumeLayout methods.

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 方法會強制立即配置。Calling the ResumeLayout method forces an immediate layout if there are any pending layout requests.

當您調整控制項的多個屬性時,SuspendLayoutResumeLayout 方法會一起使用,以隱藏多個 Layout 事件。The SuspendLayout and ResumeLayout methods are used in tandem to suppress multiple Layout events while you adjust multiple attributes of the control. 例如,您通常會呼叫 SuspendLayout 方法,然後設定控制項的 [Size]、[Location]、[Anchor] 或 [Dock] 屬性,然後呼叫 ResumeLayout 方法,讓變更生效。For example, you would typically call the SuspendLayout method, then set the Size, Location, Anchor, or Dock properties of the control, and then call the ResumeLayout method to enable the changes to take effect.

必須有 SuspendLayout 的暫止呼叫,才能成功呼叫 ResumeLayoutThere must be no pending calls to SuspendLayout for ResumeLayout to be successfully called.

另請參閱

ResumeLayout(Boolean)

繼續平常的配置邏輯,選擇性地強制暫止配置要求的立即配置。Resumes usual layout logic, optionally forcing an immediate layout of pending layout requests.

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

參數

performLayout
Boolean

true 以執行暫止配置要求,否則為 falsetrue to execute pending layout requests; otherwise, false.

備註

如果有任何暫止的版面配置要求,呼叫 ResumeLayout 方法會強制立即配置。Calling the ResumeLayout method forces an immediate layout if there are any pending layout requests. performLayout 參數設定為 true 時,如果有任何暫止的版面配置要求,就會發生立即配置。When the performLayout parameter is set to true, an immediate layout occurs if there are any pending layout requests.

當您調整控制項的多個屬性時,SuspendLayoutResumeLayout 方法會一起使用,以隱藏多個 Layout 事件。The SuspendLayout and ResumeLayout methods are used in tandem to suppress multiple Layout events while you adjust multiple attributes of the control. 例如,您通常會呼叫 SuspendLayout 方法,然後設定控制項的 [Size]、[Location]、[Anchor] 或 [Dock] 屬性,然後呼叫 ResumeLayout 方法,讓變更生效。For example, you would typically call the SuspendLayout method, then set the Size, Location, Anchor, or Dock properties of the control, and then call the ResumeLayout method to enable the changes to take effect.

必須有 SuspendLayout 的暫止呼叫,才能成功呼叫 ResumeLayoutThere must be no pending calls to SuspendLayout for ResumeLayout to be successfully called.

注意

將數個控制項加入至父控制項時,建議您先呼叫 SuspendLayout 方法,再初始化要加入的控制項。When adding several controls to a parent control, it is recommended that you call the SuspendLayout method before initializing the controls to be added. 將控制項加入至父控制項之後,請呼叫 ResumeLayout 方法。After adding the controls to the parent control, call the ResumeLayout method. 這會增加具有許多控制項之應用程式的效能。This will increase the performance of applications with many controls.

另請參閱

適用於