This documentation is archived and is not being maintained.

Control.ResumeLayout Method ()

Resumes usual layout logic.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in

void ResumeLayout ()
public void ResumeLayout ()
public function ResumeLayout ()

Calling the ResumeLayout method forces an immediate layout if there are any pending layout requests.

The SuspendLayout and ResumeLayout methods are used in tandem to suppress multiple Layout events while you adjust multiple attributes of the control. 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.

The SuspendLayout calls must be equal to zero before ResumeLayout can be successfully called.

The following code example adds two buttons to a form. The example transactions the addition of the buttons by using the SuspendLayout and ResumeLayout methods.

   void AddButtons()
      // Suspend the form layout and add two buttons.
      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 );

private void AddButtons()
    // Suspend the form layout and add two buttons.
    Button buttonOK = new Button();
    buttonOK.set_Location(new Point(10, 10));
    buttonOK.set_Size(new Size(75, 25));

    Button buttonCancel = new Button();
    buttonCancel.set_Location(new Point(90, 10));
    buttonCancel.set_Size(new Size(75, 25));

    this.get_Controls().AddRange(new Control[] {buttonOK, buttonCancel});
} //AddButtons

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0