View Full Version : سوال: resumelayout+performlayout?

شنبه 20 تیر 1388, 19:29 عصر
کسی میدو نه 3 تابع زیر کارشون چیه؟


دوشنبه 22 تیر 1388, 11:28 صبح
for every body that wants now
first know whats layout
The Layout event occurs when child controls are added or removed, when the bounds of the control changes, and when other changes occur that can affect the layout of the control. The layout event can be suppressed using the SuspendLayout and ResumeLayout methods. Suspending layout enables you to perform multiple actions on a control without having to perform a layout for each change. For example, if you resize and move a control, each operation would raise a Layout event.

The layout logic of the control is suspended until the ResumeLayout method is called.

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.

If the SuspendLayout method was called before calling the PerformLayout method, the Layout event is suppressed

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