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

注解

如果存在任何挂起的布局请求,则调用方法会强制立即进行布局。ResumeLayoutCalling the ResumeLayout method forces an immediate layout if there are any pending layout requests.

在您ResumeLayout调整控件的多个属性时Layout,和方法在一起使用以取消多个事件。 SuspendLayoutThe SuspendLayout and ResumeLayout methods are used in tandem to suppress multiple Layout events while you adjust multiple attributes of the control. 例如,你通常SuspendLayout会调用方法,然后设置控件的SizeLocationAnchorDock属性,然后调用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对于要成功调用的,不能ResumeLayout有任何挂起的调用。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.

注解

如果存在任何挂起的布局请求,则调用方法会强制立即进行布局。ResumeLayoutCalling the ResumeLayout method forces an immediate layout if there are any pending layout requests. 当参数设置为true时,如果存在任何挂起的布局请求,则会立即进行布局。 performLayoutWhen the performLayout parameter is set to true, an immediate layout occurs if there are any pending layout requests.

在您ResumeLayout调整控件的多个属性时Layout,和方法在一起使用以取消多个事件。 SuspendLayoutThe SuspendLayout and ResumeLayout methods are used in tandem to suppress multiple Layout events while you adjust multiple attributes of the control. 例如,你通常SuspendLayout会调用方法,然后设置控件的SizeLocationAnchorDock属性,然后调用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对于要成功调用的,不能ResumeLayout有任何挂起的调用。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.

另请参阅

适用于