Control.ResumeLayout Control.ResumeLayout Control.ResumeLayout Control.ResumeLayout Method

定义

恢复正常的布局逻辑。Resumes the usual layout logic.

重载

ResumeLayout() ResumeLayout() ResumeLayout() ResumeLayout()

恢复正常的布局逻辑。Resumes usual layout logic.

ResumeLayout(Boolean) ResumeLayout(Boolean) ResumeLayout(Boolean) ResumeLayout(Boolean)

恢复正常的布局逻辑,可以选择强制对挂起的布局请求立即进行布局。Resumes usual layout logic, optionally forcing an immediate layout of pending layout requests.

ResumeLayout() ResumeLayout() ResumeLayout() 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方法,然后设置SizeLocationAnchor,或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.

必须有未挂起调用SuspendLayoutResumeLayout成功调用。There must be no pending calls to SuspendLayout for ResumeLayout to be successfully called.

另请参阅

ResumeLayout(Boolean) ResumeLayout(Boolean) ResumeLayout(Boolean) 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 Boolean Boolean 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方法,然后设置SizeLocationAnchor,或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.

必须有未挂起调用SuspendLayoutResumeLayout成功调用。There 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.

另请参阅

适用于