Control.SuspendLayout Control.SuspendLayout Control.SuspendLayout Control.SuspendLayout Method

정의

컨트롤의 레이아웃 논리를 임시로 일시 중단합니다.Temporarily suspends the layout logic for the control.

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

예제

다음 코드 예제에서는 폼에 단추 두 개를 추가합니다.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 메서드가 호출 됩니다.The layout logic of the control is suspended until the ResumeLayout method is called.

SuspendLayout 하 고 ResumeLayout 메서드는 동시에 표시 하지 않는 데 여러 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 에 대 한 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.

적용 대상

추가 정보