Export (0) Print
Expand All

Control.ResumeLayout Method ()

Resumes usual layout logic.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public void ResumeLayout ()
public void ResumeLayout ()
public function ResumeLayout ()
Not applicable.

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.

There must be no pending calls to SuspendLayout for ResumeLayout to 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.

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 void AddButtons()
{
    // Suspend the form layout and add two buttons.
    this.SuspendLayout();
    Button buttonOK = new Button();
    buttonOK.set_Location(new Point(10, 10));
    buttonOK.set_Size(new Size(75, 25));
    buttonOK.set_Text("OK");

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

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

Windows 98, Windows Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft